2

I am current using Crashlytics to collect errors that user run into, and one of the error shows the following. I was unable to reproduce the error or locate the cause since I don't really understand the log.

0  myapp                       0x10065b254 specialized 
ChatViewController.collectionView(_:messageDataForItemAt:) (ChatViewController.swift:693)
1  myapp                       0x100652ed0 @objc ChatViewController.collectionView(_:messageDataForItemAt:) + 4299091664
2  JSQMessagesViewController      0x10112d0dc -[JSQMessagesCollectionViewFlowLayout messageBubbleSizeForItemAtIndexPath:] (JSQMessagesCollectionViewFlowLayout.m:407)
3  JSQMessagesViewController      0x10112d2c0 -[JSQMessagesCollectionViewFlowLayout jsq_configureMessageCellLayoutAttributes:] (JSQMessagesCollectionViewFlowLayout.m:434)
4  JSQMessagesViewController      0x10112c828 __73-[JSQMessagesCollectionViewFlowLayout layoutAttributesForElementsInRect:]_block_invoke (JSQMessagesCollectionViewFlowLayout.m:310)
5  CoreFoundation                 0x182fb54d0 -[__NSFrozenArrayM enumerateObjectsWithOptions:usingBlock:] + 160
6  JSQMessagesViewController      0x10112c77c -[JSQMessagesCollectionViewFlowLayout layoutAttributesForElementsInRect:] (JSQMessagesCollectionViewFlowLayout.m:308)
7  UIKit                          0x18c4bfca4 __45-[UICollectionViewData validateLayoutInRect:]_block_invoke + 252
8  UIKit                          0x18c4bf600 -[UICollectionViewData validateLayoutInRect:] + 1500
9  UIKit                          0x18c4bea40 -[UICollectionView layoutSubviews] + 260
10 UIKit                          0x18c462304 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1276
11 QuartzCore                     0x18701bec8 -[CALayer layoutSublayers] + 184
12 QuartzCore                     0x18701ffa8 CA::Layer::layout_if_needed(CA::Transaction*) + 332
13 QuartzCore                     0x186f8ea98 CA::Context::commit_transaction(CA::Transaction*) + 336
14 QuartzCore                     0x186fb4eb4 CA::Transaction::commit() + 540
15 QuartzCore                     0x186f09a04 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 928
16 IOKit                          0x1832981cc IODispatchCalloutFromCFMessage + 392
17 CoreFoundation                 0x182fbc010 __CFMachPortPerform + 188
18 CoreFoundation                 0x182fd696c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
19 CoreFoundation                 0x182fd6070 __CFRunLoopDoSource1 + 440
20 CoreFoundation                 0x182fd3b44 __CFRunLoopRun + 2196
21 CoreFoundation                 0x182ef3fb8 CFRunLoopRunSpecific + 436
22 GraphicsServices               0x184d8bf84 GSEventRunModal + 100
23 UIKit                          0x18c4c82f4 UIApplicationMain + 208
24 myapp                       0x100627470 main (AppDelegate.swift:22)
25 libdyld.dylib                  0x182a1656c start + 4

Here is the code on ChatViewControler ln 693

(line 693 ->) override func collectionView(_ collectionView: JSQMessagesCollectionView!, messageDataForItemAt indexPath: IndexPath!) -> JSQMessageData! {
    return self.messages[indexPath.row]
}

and here is some source from JSQMessagesCollectionViewFlowLayout

- (CGSize)messageBubbleSizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    (line 407 ->) id<JSQMessageData> messageItem = [self.collectionView.dataSource collectionView:self.collectionView
                                                      messageDataForItemAtIndexPath:indexPath];

    return [self.bubbleSizeCalculator messageBubbleSizeForMessageData:messageItem
                                                          atIndexPath:indexPath
                                                           withLayout:self];
}

Could someone provide me with some insight so that I could solve this? Thank you.

Update

  1. Normally it would provide an error like Fatal Exception: NSInternalInconsistencyException follow with some description.

    I couldn't find anything with this fatal error. FYR below is a screenshot

    Crashlytics exc_exception screenshot

Todd Burner
  • 2,202
  • 12
  • 15
Vincent Lam
  • 151
  • 2
  • 2
  • 10
  • is there a line in the crash log that says something similar to "Application Specific Information"? Because a crash-log is usually more than just a backtrace. There should be an error message near that line, e.g. "...implicitely unwrapped optional... nil" – Michael Apr 14 '18 at 18:45
  • The reason probably is that `messages[indexPath.row]` was nil during the call. – Michał Kwiecień Apr 14 '18 at 19:04
  • @MichałKwiecień: probably. That would give an array-out-of-bounds-error. For this reason crash reports have always an error message, and that error message is a very important part in reading a crash log. Omitting it from a question makes the question basically unanswerable. – Michael Apr 14 '18 at 19:07
  • @Michael Yes, normally it would. But I cannot find any specific information on this specific error, I just updated the question. Please have a look. – Vincent Lam Apr 15 '18 at 03:47
  • @MichałKwiecień I updated the question please have a look. – Vincent Lam Apr 15 '18 at 03:58
  • Omg, that‘s bad. – Michael Apr 15 '18 at 08:38
  • Does a code offset of "+ 4299091664" seem improbable to anyone else? (I don't know what it might mean...just observing.) – Phillip Mills Apr 17 '18 at 15:28
  • @PhillipMills: that's indeed strange. It's a good-looking number in hexadecimal, just a bit above 2^32: 0x1003EEED0. – Michael Apr 17 '18 at 16:13
  • I also think it is interesting that the program crashes in the function prolog. It crashes in line 693, and there is just a function signature at that line, no statement. My first instinct was that it probably has something to do with the Swift/Objc-bridge, i.e. that it crashes because it expected an object of type JSQMessagesCollectionView, but got an object of a different type. But a quick test in the simulator showed that this is not the case, because the parameters are not checked in Swift code, it is just assumed that they are correct. You may get "unrecognized selector" errors though. – Michael Apr 17 '18 at 16:16
  • One more idea: have you looked at the „Raw text“? There is a „Raw Text“ button at the right top position in the screenshot that you posted. It should contain more information than what we see at the screenshot. – Michael Apr 18 '18 at 13:50
  • @Michael Thank you for your response, the content in "Raw Text" is exactly as the first quote from this post. One question, would that be something related to index out of bounds exception? Cause there is actually another bug that might cause this issue, but I can't really reproduce to confirm that. – Vincent Lam Apr 18 '18 at 15:43
  • Maybe. You could try to intentionally create an index out of bounds error, e.g. by changing line 694 to something like `return self.messages[99999]` - if it crashes without description, it is likely that this was the problem. If it crashes, but with an „index out of bounds“ description, the problem is most likely somewhere else. – Michael Apr 18 '18 at 19:31

0 Answers0