我花了一些时间来调试我的代码以期找到解决方案,但是这种崩溃只发生在我没有连接到调试器时。
我已经设置了一个Firebase Singleton,它管理着四个不同路径的火灾基地。每个firebase都使用如下代码片段进行设置:
-(void)connectFirebaseForMatch:(NSNumber*)matchId{
if(status == FireBaseStatusConnected){
if(matchFirebase){
[matchFirebase removeAllObservers];
matchFirebase = nil;
}
NSString *baseURL = [NSString stringWithFormat:@"%@matches/%@",kFirechatNS,matchId];
matchFirebase = [[Firebase alloc] initWithUrl:baseURL];
if(!matchFirebase){
return;
}
__weak FirebaseClient *bSelf = self;
void(^messages_block_with_connection)(FDataSnapshot*) = ^(FDataSnapshot* snapshot){
if(snapshot){
[[LACoreDataStore sharedStore] updateMessageWithSnapshot:snapshot forMatchId:matchId dateFormatter:writingDateFormatter withCompletion:^(BOOL newMessages, NSNumber *matchIdFromBlock, NSError *error) {
//Tell Message View to Refresh TableView using Notification Center
[[NSObject class] cancelPreviousPerformRequestsWithTarget:bSelf selector:@selector(reloadMessagesForMatch:) object:matchIdFromBlock];
[bSelf performSelector:@selector(reloadMessagesForMatch:) withObject:matchIdFromBlock afterDelay:.1];
}];
}
};
void(^no_messages_block_with_connection)(FDataSnapshot*) = ^(FDataSnapshot* snapshot){
//Tell Message View to Refresh TableView using Notification Center
[bSelf performSelector:@selector(reloadMessagesForMatch:) withObject:matchId afterDelay:.05];
};
[matchFirebase observeEventType:FEventTypeChildAdded withBlock:messages_block_with_connection];
[matchFirebase observeSingleEventOfType:FEventTypeValue withBlock:no_messages_block_with_connection];
NSLog(@"Registered Messaging View with Firebase: %@",baseURL);
}
}
每个firebase只是将firebase中的新数据读入Core Data,并使用通知中心刷新所需的视图。
使用该应用程序似乎一切正常,但大约一天后,我在Firebase Worker上遇到此崩溃,我无法找到来源:
FSRWebSocket.m line 716
__31-[FSRWebSocket _failWithError:]_block_invoke_2
来自Crashlytics:
Crashed: FirebaseWorker
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0xb0000010
提前感谢您的帮助:)
答案 0 :(得分:0)
对不起你碰到了这个。这是Firebase SDK中的一个错误。它应该在最新版本中修复,您可以在此处获取:https://cdn.firebase.com/ObjC/Firebase.framework-LATEST.zip
如果您仍然遇到问题,请发送电子邮件至support@firebase.com。谢谢!