Google+ integration iOS - EXC_BAD_ACCESS error on signout

无人久伴 提交于 2019-12-11 09:13:15

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/19627226/google-integration-ios-exc-bad-access-error-on-signout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!