question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ios error when trying to add photo

See original GitHub issue
  • running complete ios project.
  • Adding messages no problem
  • When trying to add a photo, app bombs with following error

2016-05-20 14:37:10.156 FriendlyChatSwift[32573:72997859] *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UITableView.m:1716 2016-05-20 14:37:10.162 FriendlyChatSwift[32573:72997859] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (7), plus or minus the number of rows inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).' *** First throw call stack: ( 0 CoreFoundation 0x0000000108852d85 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010a9bddeb objc_exception_throw + 48 2 CoreFoundation 0x0000000108852bea +[NSException raise:format:arguments:] + 106 3 Foundation 0x0000000108ca3d5a -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198 4 UIKit 0x00000001095394ca -[UITableView _endCellAnimationsWithContext:] + 15146 5 UIKit 0x000000010954fcf0 -[UITableView _updateRowsAtIndexPaths:updateAction:withRowAnimation:] + 303 6 FriendlyChatSwift 0x0000000105a13f16 _TFFC17FriendlyChatSwift16FCViewController14viewWillAppearFSbT_U_FCSo15FIRDataSnapshotT_ + 774 7 FriendlyChatSwift 0x0000000105adf419 __63-[FIRDatabaseQuery observeEventType:withBlock:withCancelBlock:]_block_invoke + 37 8 FriendlyChatSwift 0x0000000105b064bc __43-[FChildEventRegistration fireEvent:queue:]_block_invoke64 + 88 9 libdispatch.dylib 0x000000010b467d9d _dispatch_call_block_and_release + 12 10 libdispatch.dylib 0x000000010b4883eb _dispatch_client_callout + 8 11 libdispatch.dylib 0x000000010b4701ef _dispatch_main_queue_callback_4CF + 1738 12 CoreFoundation 0x00000001087ac0f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 13 CoreFoundation 0x000000010876db99 __CFRunLoopRun + 2073 14 CoreFoundation 0x000000010876d0f8 CFRunLoopRunSpecific + 488 15 GraphicsServices 0x000000010c8bcad2 GSEventRunModal + 161 16 UIKit 0x0000000109409f09 UIApplicationMain + 171 17 FriendlyChatSwift 0x0000000105a1974d main + 125 18 libdyld.dylib 0x000000010b4bc92d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
ethanneffcommented, May 23, 2016

missing self.clientTable.reloadData() after self.messages.removeAll()

  override func viewDidAppear(animated: Bool) {
    self.messages.removeAll()
    self.clientTable.reloadData()
    // Listen for new messages in the Firebase database
    _refHandle = self.ref.child("messages").observeEventType(.ChildAdded, withBlock: { (snapshot) -> Void in
      self.messages.append(snapshot)
      let indexPath = NSIndexPath(forRow: self.messages.count-1, inSection: 0)
      self.clientTable.insertRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
      self.clientTable.scrollToRowAtIndexPath(indexPath, atScrollPosition: .Bottom, animated: true)
    })
  }
1reaction
ethanneffcommented, May 23, 2016

@JosephGarcia by moving the code from viewDidAppear() to viewDidLoad(), you will remove the Realtime Database from the app whenever a user open the Camera Picker. The database listener is removed within viewWillDisappear().

  override func viewWillDisappear(animated: Bool) {
    self.ref.removeObserverWithHandle(_refHandle)
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Top 9 Ways to Fix Unable to Load Photo Error on iPhone
Top 9 Ways to Fix Unable to Load Photo Error on iPhone · 1. Restart iPhone · 2. Check Internet Connection · 3....
Read more >
13 Ways to fix unable to load photo or video error on iPhone
To fix unable to load photo or video error on iPhone, 1. Check your iPhone storage, 2. Force quit and open Photos, 3....
Read more >
8 Ways to Fix 'Unable to Load Photo or Video' Error on iOS
How to Fix 'Unable to Load Photo or Video' Error on iOS Devices. · 1. Turn Off Storage Optimization. · 2. Free Up...
Read more >
There Was An Error Loading This Photo, Fix it Here
Cannot Load Photo: There Was An Error Loading This Photo, Fix it Here · 1. iCloud servers · 2. Update your iPhone or...
Read more >
"Unable to load photo" on iPhone - Apple Support Communities
why does it say that i am unable to load my photos. i even turned on download and keep originals but it still...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found