Launched through the Firebase tutorial for codelabs covering FriendlyChat. Fixed a persistent problem (elsewhere), but when I go to download the selected image, the application crashes. I followed all the steps and tested the "full" version of the source code to make sure that this is not what I was doing. Bad luck. Does anyone else see this problem?
Here is the exception ...
2016-05-23 17: 25: 13.119 FriendlyChatSwift [61549: 15581893] *** The application terminated due to the unannounced exception "NSInternalInconsistencyException", reason: "Invalid update: invalid number of lines in section 0. The number of lines contained in the existing section after how update (1) should be equal to the number of lines contained in this section before updating (6) plus or minus the number of lines inserted or deleted from this section (1 inserted, 0 deleted) and plus or minus the number of lines moved to or from this section (0 moved, 0 moved) .
When I check the number of messages on boot, this is normal. When I go to imagePicker and return, the sudden number of posts is 1, but the number of lines is still 6.
The problem seems to be here:
override func viewWillAppear(animated: Bool) {
self.messages.removeAll()
_refHandle = self.ref.child("messages").observeEventType(.ChildAdded, withBlock: { (snapshot) -> Void in
self.messages.append(snapshot)
self.clientTable.insertRowsAtIndexPaths([NSIndexPath(forRow: self.messages.count-1, inSection: 0)], withRowAnimation: .Automatic)
})
}
, insertRowsAtIndexPaths.