Support Topics Documentation Slack YouTube Blog

Crash on user logout in iOS SDK

(Vasyl Myronchuk) #1

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

(Mark Piller) #2

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

(Vasyl Myronchuk) #3

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.

(Vyacheslav Vdovichenko) #4

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:</img>
How did you get the crash? What did you do with this ‘nil’ response?


(Vyacheslav Vdovichenko) #5

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?

(Vasyl Myronchuk) #6

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.

(Vyacheslav Vdovichenko) #7

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

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

(Vasyl Myronchuk) #8

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.

(Vyacheslav Vdovichenko) #9

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

Thank you,

(Andrew Akpe Doe) #10

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

(Mark Piller) #11

Hi Andrew,

Make sure to install the SDK per the instructions in the documentation:

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


(Andrew Akpe Doe) #12

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 :
print(“logged out”)
}, error: { fault in
print(“error logging out”)
I get an : isNSURLErrorDomain error
Any help will be appreciated, thanks

(Olha Danylova) #13

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