我将'XBChatModule'
Cocoapods 中的库集成到我的项目中。
当我第一次运行代码时,它通过抛出以下错误使应用程序崩溃-[XBMessage messageHash]: unrecognized selector sent to instance并通过XBMessage.m
如下更改文件得到解决
XBMessage.m
- (NSUInteger)messageHash
{
return self.hash;
}
但这会产生新的问题说
Assertion failure in -[ChatMessagesController collectionView:cellForItemAtIndexPath:], /Users/Neelacharya/Harshit/LIve Projects/Project/V1/Source/Project/Pods/JSQMessagesViewController/JSQMessagesViewController/Controllers/JSQMessagesViewController.m:452
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: messageSenderId != nil'
*** First throw call stack:
(
0 CoreFoundation 0x000000011161ca75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001112b1bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000011161c8da +[NSException raise:format:arguments:] + 106
3 Foundation 0x000000010edcfb6f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 CinchGaming 0x000000010d7be3c5 -[JSQMessagesViewController collectionView:cellForItemAtIndexPath:] + 693
5 CinchGaming 0x000000010d7f5f6d -[XBMessageViewController collectionView:cellForItemAtIndexPath:] + 141
6 UIKit 0x00000001102b9fab -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 244
7 UIKit 0x00000001102bb6e4 -[UICollectionView _updateVisibleCellsNow:] + 3445
8 UIKit 0x00000001102bf391 -[UICollectionView layoutSubviews] + 243
9 UIKit 0x000000010fd041c3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
10 QuartzCore 0x000000010f9d2c58 -[CALayer layoutSublayers] + 150
11 QuartzCore 0x000000010f9c787e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
12 QuartzCore 0x000000010f9c76ee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
13 QuartzCore 0x000000010f93536e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
14 QuartzCore 0x000000010f936482 _ZN2CA11Transaction6commitEv + 390
15 QuartzCore 0x000000010f936aed _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
16 CoreFoundation 0x0000000111551507 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
17 CoreFoundation 0x0000000111551460 __CFRunLoopDoObservers + 368
18 CoreFoundation 0x0000000111547293 __CFRunLoopRun + 1123
19 CoreFoundation 0x0000000111546bc6 CFRunLoopRunSpecific + 470
20 GraphicsServices 0x0000000112796a58 GSEventRunModal + 161
21 UIKit 0x000000010fc8a580 UIApplicationMain + 1282
22 CinchGaming 0x000000010d67e463 main + 115
23 libdyld.dylib 0x0000000111b4e145 start + 1
24 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
我了解崩溃的原因是成员messageSenderId 在 JSQMessagesViewController.m文件的第 452 行为零。但我不知道它为什么会发生以及如何解决它。
我还向Github的作者报告了问题,但没有得到回复。
如果您能帮助我解决问题,我将不胜感激。