当我在调试模式下运行时,我的应用程序没有错误,但是当我在发布模式下运行时,我在消息视图中收到此错误尝试显示消息:
2016-09-14 16:17:31.305 MyApp[70800:1072070] -[_TtCs19_NSContiguousString messageHash]: unrecognized selector sent to instance 0x7fa4eb461db0
2016-09-14 16:17:31.318 MyApp[70800:1072070] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_TtCs19_NSContiguousString messageHash]: unrecognized selector sent to instance 0x7fa4eb461db0'
*** First throw call stack:
(
0 CoreFoundation 0x0000000108979d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010a866deb objc_exception_throw + 48
2 CoreFoundation 0x0000000108982d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001088c8cfa ___forwarding___ + 970
4 CoreFoundation 0x00000001088c88a8 _CF_forwarding_prep_0 + 120
5 JSQMessagesViewController 0x0000000108549e7c -[JSQMessagesBubblesSizeCalculator messageBubbleSizeForMessageData:atIndexPath:withLayout:] + 130
6 JSQMessagesViewController 0x000000010854f960 -[JSQMessagesCollectionViewFlowLayout messageBubbleSizeForItemAtIndexPath:] + 232
7 JSQMessagesViewController 0x000000010854faec -[JSQMessagesCollectionViewFlowLayout jsq_configureMessageCellLayoutAttributes:] + 97
8 JSQMessagesViewController 0x000000010854ed86 __73-[JSQMessagesCollectionViewFlowLayout layoutAttributesForElementsInRect:]_block_invoke + 92
9 CoreFoundation 0x00000001088b4afd __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 77
10 CoreFoundation 0x00000001088b49a6 -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 166
11 JSQMessagesViewController 0x000000010854ecf5 -[JSQMessagesCollectionViewFlowLayout layoutAttributesForElementsInRect:] + 1211
12 UIKit 0x0000000109b8658a __45-[UICollectionViewData validateLayoutInRect:]_block_invoke + 144
13 UIKit 0x0000000109b85fd7 -[UICollectionViewData validateLayoutInRect:] + 3067
14 UIKit 0x0000000109b3253a -[UICollectionView layoutSubviews] + 199
15 UIKit 0x000000010936d980 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
16 QuartzCore 0x000000010df80c00 -[CALayer layoutSublayers] + 146
17 QuartzCore 0x000000010df7508e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
18 QuartzCore 0x000000010df74f0c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
19 QuartzCore 0x000000010df693c9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
20 QuartzCore 0x000000010df97086 _ZN2CA11Transaction6commitEv + 486
21 QuartzCore 0x000000010df977f8 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
22 CoreFoundation 0x000000010889ec37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
23 CoreFoundation 0x000000010889eba7 __CFRunLoopDoObservers + 391
24 CoreFoundation 0x00000001088947fb __CFRunLoopRun + 1147
25 CoreFoundation 0x00000001088940f8 CFRunLoopRunSpecific + 488
26 GraphicsServices 0x000000010bb8fad2 GSEventRunModal + 161
27 UIKit 0x00000001092b2f09 UIApplicationMain + 171
28 MyApp 0x0000000106f69e6d main + 125
29 libdyld.dylib 0x000000010b37192d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
我不确定为什么仅在发布模式中出现这种情况,但是有人有修复吗?
答案 0 :(得分:1)
看起来问题与消息的消息散列有关。确保正确设置了消息对象。因为它坚持
JSQMessageData
协议