Question

I have spent time debugging my code in hopes of a solution, but this crash only happens when I'm not connected to the debugger.

I have set up a Firebase Singleton that manages four firebases with different paths. Each firebase is setup using a snippet of code like this:

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

    }
}

Each firebase simply reads the new data from firebase into Core Data and uses the notification center to refresh whichever views are necessary.

All seems to work fine while using the app, but after a day or so I get this crash on the Firebase Worker and I am unable to find the source:

FSRWebSocket.m line 716
__31-[FSRWebSocket _failWithError:]_block_invoke_2

From Crashlytics:

Crashed: FirebaseWorker
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0xb0000010

Thank you in advance for your help :)

Was it helpful?

Solution

Sorry you ran into this. It's a bug in the Firebase SDK. It should be fixed in the very latest version, which you can grab here: https://cdn.firebase.com/ObjC/Firebase.framework-LATEST.zip

If you still have issues, shoot us an email at support@firebase.com. Thanks!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top