简体   繁体   中英

Google+ integration iOS - EXC_BAD_ACCESS error on signout

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM