【问题标题】:Firebase Worker Crash on failWithErrorFirebase Worker 在 failWithError 上崩溃
【发布时间】:2014-03-05 07:46:10
【问题描述】:

我花了一些时间调试我的代码,希望能找到解决方案,但只有在我没有连接到调试器时才会发生这种崩溃。

我设置了一个 Firebase Singleton,用于管理具有不同路径的四个 Firebase。每个 Firebase 都是使用如下代码的 sn-p 设置的:

-(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

提前感谢您的帮助:)

【问题讨论】:

  • 如果你使用的是通知中心,那么你应该检查所有注册事件的观察者是否自己取消注册,例如在 dealloc 方法中(我假设它们是 ViewControllers)

标签: ios exc-bad-access firebase worker


【解决方案1】:

抱歉,您遇到了这个问题。这是 Firebase SDK 中的一个错误。它应该在最新版本中得到修复,您可以在此处获取:https://cdn.firebase.com/ObjC/Firebase.framework-LATEST.zip

如果您仍有问题,请发送电子邮件至 support@firebase.com。谢谢!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-30
    • 2020-03-26
    • 1970-01-01
    • 1970-01-01
    • 2019-03-28
    • 1970-01-01
    相关资源
    最近更新 更多