Reputation: 3285
I've done google+ integration in my app and it works perfectly fine. But I have noticed that occasionally I receive an EXC_BAD_ACCESS error during logout. This is my logout function
-(void) logout
{
[[GPPSignIn sharedInstance]signOut];
[[GPPSignIn sharedInstance] disconnect]; // EXC_BAD_ACCESS Error occurs in this line
}
I dont always get this error, I think it may have to do something related with session. I've tried searching for it but haven't found any resolution so far. This error occurs very rarely and I dont know when exactly this happens. When I run the app after this error it works fine and there are no issues. But still its an error and I was wondering if anyone else had the same experience and had found any workaround for this.
Upvotes: 1
Views: 475
Reputation: 8402
The problem seems to be due to calling both signOut and disconnect methods. The disconnect method also performs the signout. The docs say "The token is needed to disconnect so do not call signOut if disconnect is to be called."
If you want to only sign out the user, just call the "signOut" method, for example:
- (void)signOut
{
[[GPPSignIn sharedInstance] signOut];
}
If you want to disconnect the user (revoke your app's API access on behalf of the user), the method also performs sign out:
- (void)disconnect
{
[[GPPSignIn sharedInstance] disconnect];
}
You should also implement the didDisconnectWithError:(NSError *)error
method for cleaning up the user details and following Google+'s policies around disconnects.
Read the official Google+ iOS docs for more information.
Upvotes: 2