Crash on Facebook logout

Hello,

I am am using Facebook login with the following code

- (IBAction)onLoginButton:(id)sender {

    FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];

    [login logInWithReadPermissions: @[@"public_profile"]

                 fromViewController:self

                            handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {

         if (error) {

             NSLog(@"Process error");

         } else if (result.isCancelled) {

             NSLog(@"Cancelled");

         } else {

             @try {

                 FBSDKAccessToken *token = [FBSDKAccessToken currentAccessToken];

                 NSString *userId = token.userID;

                 NSString *tokenString = token.tokenString;

                 NSDate *expirationDate = token.expirationDate;

                 NSDictionary *fieldsMapping = @{@"email":@"email"};

                 BackendlessUser *user = [backendless.userService loginWithFacebookSDK:userId tokenString:tokenString expirationDate:expirationDate fieldsMapping:fieldsMapping];

                 

                 [self dismiss];

                 NSLog(@"USER: %@", user);

             }

             @catch (Fault *fault) {

                 NSLog(@"fault: %@", fault);

             }

             

             NSLog(@"Logged in");

         }

     }];

}

It works fine. However, there is a problem on logout. This is the code:

- (void)logoutWithCompletion:(void (^)(FINError *error))completion

{

    [backendless.userService logout:^void (id idOfSomething) {

        completion(nil);

    } error:^void (Fault *fault) {

        FINError *error = [[FINError alloc] initWithFault:fault];

        completion(error);

    }];

}

It causes the following crash:

Crashed: com.apple.main-thread 
0 libobjc.A.dylib 0x1859c17f4 objc_object::release() + 16 
1 Help A Paw 0x100f93390 -[UserService onLogout:] (UserService.m:573) 
2 Help A Paw 0x100fc739c -[Responder responseHandler:] (Responder.m:208) 
3 Help A Paw 0x100f94c94 -[HttpEngine processAsyncAMFResponse:] (HttpEngine.m:254) 
4 libdispatch.dylib 0x1860d9088 _dispatch_call_block_and_release + 24 
5 libdispatch.dylib 0x1860d9048 _dispatch_client_callout + 16 
6 libdispatch.dylib 0x1860e5b74 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1016 
7 CoreFoundation 0x1866fdeb0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 
8 CoreFoundation 0x1866fba8c __CFRunLoopRun + 2012 
9 CoreFoundation 0x18661bfb8 CFRunLoopRunSpecific + 436 
10 GraphicsServices 0x1884b3f84 GSEventRunModal + 100 
11 UIKit 0x18fbf02f4 UIApplicationMain + 208 
12 Help A Paw 0x100f4b924 main (main.m:14) 
13 libdyld.dylib 0x18613e56c start + 4

After some back-tracing I found out that this line is somehow the cause of the problem:

[backendless.data mapTableToClass:@"Users" type:[BackendlessUser class]];

If I comment it logout works fine. I was advised to use it in this thread

What would be the solution to have both the Users relations mapped to BackendlessUser objects AND have logout after Facebook login work, too?

Best,
Milen

Hello Milen,

We are working on it and answer you as soon as possible.

Regards, Olga

This issue has been fixed. Please update to the newest version of iOS-SDK 4.0.17 and verify whether it works now.

Regards, Olga

Wow, that was a fast update!

I confirm logout is working fine with 4.0.17!

Thanks for the quick reaction!