IOS 集成客服崩溃
这个方法崩溃
- (void)_loadMessagesBefore:(NSString*)messageId
count:(NSInteger)count
append:(BOOL)isAppend
{
__weak typeof(self) weakSelf = self;
void (^refresh)(NSArray *messages) = ^(NSArray *messages) {
dispatch_async(_messageQueue, ^{
//Format the message
NSArray *formattedMessages = [weakSelf formatMessages:messages];
//Refresh the page
dispatch_async(dispatch_get_main_queue(), ^{
HDMessageViewController *strongSelf = weakSelf;
if (strongSelf) {
NSInteger scrollToIndex = 0;
if (isAppend) {
[strongSelf.messsagesSource insertObjects:messages atIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [messages count])]];
//Combine the message
id object = [strongSelf.dataArray firstObject];
if ([object isKindOfClass:[NSString class]]) {
NSString *timestamp = object;
[formattedMessages enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id model, NSUInteger idx, BOOL *stop) {
if ([model isKindOfClass:[NSString class]] && [timestamp isEqualToString:model]) {
[strongSelf.dataArray removeObjectAtIndex:0];
*stop = YES;
}
}];
}
scrollToIndex = [strongSelf.dataArray count];
[strongSelf.dataArray insertObjects:formattedMessages atIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [formattedMessages count])]];
}
else {
[strongSelf.messsagesSource removeAllObjects];
[strongSelf.messsagesSource addObjectsFromArray:messages];
[strongSelf.dataArray removeAllObjects];
[strongSelf.dataArray addObjectsFromArray:formattedMessages];
}
HMessage *latest = [strongSelf.messsagesSource lastObject];
strongSelf.messageTimeIntervalTag = latest.timestamp;
[strongSelf.tableView reloadData];
[strongSelf.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[self.dataArray count] - scrollToIndex - 1 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];
}
});
//re-download all messages that are not successfully downloaded
for (HMessage *message in messages)
{
[weakSelf _downloadMessageAttachments:message];
}
});
};
[self.conversation loadMessagesStartFromId:messageId count:(int)count searchDirection:HMessageSearchDirectionUp completion:^(NSArray *aMessages, HError *aError) {
if (!aError && [aMessages count]) {
refresh(aMessages);
}
}];
}
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[HDFMDatabase intForQuery:]: unrecognized selector sent to instance 0x610000292cf0'
*** First throw call stack:
没有找到相关结果
已邀请:
5 个回复
breakfly
donghai
breakfly
if (!aError && [aMessages count]) {
refresh(aMessages);
}
}];
是数据库报错了,错误应该是本地数据库取数据报错了,我没有找到环信本地数据库在什么地方创建的
[已注销]
breakfly
*** First throw call stack:
(
0 CoreFoundation 0x0000000109801d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010925f21e objc_exception_throw + 48
2 CoreFoundation 0x0000000109871f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000109787005 ___forwarding___ + 1013
4 CoreFoundation 0x0000000109786b88 _CF_forwarding_prep_0 + 120
5 UUXueSheng 0x0000000102292c86 -[FLDBManager messageCountOfConversation] + 86
6 UUXueSheng 0x000000010228fcc1 -[FLDBManager loadMessagesStartFromId:count:searchDirection:completion:] + 113
7 UUXueSheng 0x000000010226837e -[HConversation loadMessagesStartFromId:count:searchDirection:completion:] + 142
8 UUXueSheng 0x00000001020bc3f7 -[HDMessageViewController _loadMessagesBefore:count:append:] + 455
9 UUXueSheng 0x00000001020c6a88 -[HDMessageViewController tableViewDidTriggerHeaderRefresh] + 360
10 UUXueSheng 0x00000001020b5b82 -[HDMessageViewController viewDidLoad] + 3410
11 UIKit 0x0000000106a2fa3d -[UIViewController loadViewIfRequired] + 1258
12 UIKit 0x0000000106a36062 -[UIViewController __viewWillAppear:] + 118
13 UIKit 0x0000000106a611d3 -[UINavigationController _startCustomTransition:] + 1290
14 UIKit 0x0000000106a71e48 -[UINavigationController _startDeferredTransitionIfNeeded:] + 697
15 UIKit 0x0000000106a72fdb -[UINavigationController __viewWillLayoutSubviews] + 58
16 UIKit 0x0000000106c69dd7 -[UILayoutContainerView layoutSubviews] + 223
17 UIKit 0x0000000106952ab8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237
18 QuartzCore 0x0000000105439bf8 -[CALayer layoutSublayers] + 146
19 QuartzCore 0x000000010542d440 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
20 QuartzCore 0x000000010542d2be _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
21 QuartzCore 0x00000001053bb318 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280
22 QuartzCore 0x00000001053e83ff _ZN2CA11Transaction6commitEv + 475
23 QuartzCore 0x00000001053e8d6f _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 113
24 CoreFoundation 0x00000001097a6267 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
25 CoreFoundation 0x00000001097a61d7 __CFRunLoopDoObservers + 391
26 CoreFoundation 0x000000010978af8e __CFRunLoopRun + 1198
27 CoreFoundation 0x000000010978a884 CFRunLoopRunSpecific + 420
28 GraphicsServices 0x000000010b7f4a6f GSEventRunModal + 161
29 UIKit 0x000000010688dc68 UIApplicationMain + 159
30 UUXueSheng 0x00000001021d809f main + 111
31 libdyld.dylib 0x000000010abcf68d start + 1
32 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException