Crash on user logout in iOS SDK

In case if null completion blocks are supplied in method
-(void)logout:(void(^)(id))responseBlock error:(void(^)(Fault *))errorBlock;
of UserService, crash occurs on logout (100% reproducible both simulator and real device).
Empty (instead of null) completion blocks don’t cause crash.
Crash log
Screenshot

Someone else already reported a similar problem. It is assigned to a developer.

Problem with ownerId field doesn’t look similar at all for me. I would suggest absence of checking for null of completion blocks before calling them.

Hi Vasyl,

I’ve checked the async login using this code:

-(void)userLogout {    
    NSLog(@"logout ---------------------");
      [backendless.userService logout:
        ^(id result) {
            NSLog(@"StartViewController -> userLogout: (ASYNC LOGOUT) %@ ", result);
        }
        error:^(Fault *fault) {
            NSLog(@"StartViewController -> userLogout: <ASYNC FAULT> %@", fault);
        }];
}


If async logout successfully finished - it returns <null> as result in ‘response’ block, but without any crash:
http://support.backendless.com/public/attachments/bff74e78ca53191fe97f5756fd6d1433.png&lt;/img&gt;
How did you get the crash? What did you do with this ‘nil’ response?

Slava

What do you mean, when you tell: “Empty (instead of null) completion blocks don’t cause crash.”?
Maybe exactly your code in response block (you did not show it) was a cause of the crash?

Ok, here is a null completion block:

[[Backendless sharedInstance].userService logout:NULL error:NULL];

And here is empty completion block:

 [[Backendless sharedInstance].userService logout:^(id r){} error:^(Fault *f){}];

The fist case leads to crash, the second doesn’t.

Ok, Vasil. Do you need an async method without any response? Use async method with responder == nil:

[[Backendless sharedInstance].userService logout:NULL ];

Yes, I need async method (not blocking UI), and at the same time I do not care about response. I already have workaround of this, but the bug in SDK remains - thats why I reported the issue in the first place. Because, for example, I’m not the only one who might encounter this, and the second, if this crash happens in this place, maybe in fact it happening in other places too.

Hi Vasyl,
This issue is fixed, you can get the fixed libs from github (please change backendless & CommLibiOS)

Thank you,
Slava

Hi, I’ve seen the files in github, but can you please give a step by step guide on how to use them in my code. I don’t want to kinda replace wrong files. And just this logout error has prevented me from pushing my codes to the playstore for a week now. Thanks, an immediate response would be greatly appreciated. Thanks

Hi Andrew,

Make sure to install the SDK per the instructions in the documentation:
https://backendless.com/docs/ios/setup.html

This thread is rather old. The latest SDK is available in Cocoapods.

Regards,
Mark

Thanks Mark, I have followed that setup already and installed the latest sdk. I just did a pod update and am using Backendless 5.2.13. This was even working previously for me, but now anytime I run this function :
Backendless.sharedInstance().userService.logout({
print(“logged out”)
}, error: { fault in
print(“error logging out”)
})
I get an : isNSURLErrorDomain error
Any help will be appreciated, thanks

Hello Andrew,
It is working fine for me at the moment so please provide a simple project which reproduces the issue so we could check it. You can attach a link to the project’s archive here or send us to the support@backendless.com

Regards,
Olha

Thanks Olga, I just resolved this from one of your replies you gave to a similar problem. Thanks