简体   繁体   English

Google+集成iOS-退出时出现EXC_BAD_ACCESS错误

[英]Google+ integration iOS - EXC_BAD_ACCESS error on signout

I've done google+ integration in my app and it works perfectly fine. 我已经在我的应用程序中完成了google +集成,并且效果很好。 But I have noticed that occasionally I receive an EXC_BAD_ACCESS error during logout. 但是我注意到注销时偶尔会收到EXC_BAD_ACCESS错误。 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. 该问题似乎是由于同时调用signOut断开方法。 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." 文档说:“令牌需要断开连接,因此如果要断开连接,则不要调用signOut。”

If you want to only sign out the user, just call the "signOut" method, for example: 如果只想注销用户,则只需调用“ signOut”方法即可,例如:

- (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: 如果要断开用户连接(代表用户撤消应用程序的API访问权限),则该方法还会执行注销:

 - (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 . 您还应该实现didDisconnectWithError:(NSError *)error方法,以清理用户详细信息并遵循Google+关于Disconnect的政策

Read the official Google+ iOS docs for more information. 阅读官方的Google+ iOS文档 ,了解更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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