Google+集成iOS-退出时出现EXC_BAD_ACCESS错误 [英] Google+ integration iOS - EXC_BAD_ACCESS error on signout

查看:52
本文介绍了Google+集成iOS-退出时出现EXC_BAD_ACCESS错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的应用程序中完成了google +集成,并且运行良好.但是我注意到注销时偶尔会收到EXC_BAD_ACCESS错误.这是我的登出功能

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.

推荐答案

问题似乎是由于同时调用方法.断开连接方法还执行注销.文档说:令牌需要断开连接,因此如果要断开连接,则不要调用signOut."

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."

如果只想注销用户,则只需调用"signOut"方法即可,例如:

If you want to only sign out the user, just call the "signOut" method, for example:

- (void)signOut
   { 
     [[GPPSignIn sharedInstance] signOut];
 }

如果您要断开与用户的连接(代表用户撤消您应用的API访问权限),该方法还会执行注销:

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];
   }

您还应该实施didDisconnectWithError:(NSError *)error方法来清理用户详细信息,并遵循 Google+的相关政策断开连接.

You should also implement the didDisconnectWithError:(NSError *)error method for cleaning up the user details and following Google+'s policies around disconnects.

阅读 Google+ iOS官方文档以获取更多信息.

Read the official Google+ iOS docs for more information.

这篇关于Google+集成iOS-退出时出现EXC_BAD_ACCESS错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆