在iOS上解析SDK:"NSInternalInconsistencyException",原因:“除非已通过登录或注册进行了身份验证,否则无法保存用户" [英] Parse SDK on iOS: 'NSInternalInconsistencyException', reason: 'User cannot be saved unless they have been authenticated via logIn or signUp'

查看:253
本文介绍了在iOS上解析SDK:"NSInternalInconsistencyException",原因:“除非已通过登录或注册进行了身份验证,否则无法保存用户"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone应用程序中使用iOS Parse SDK.应用首次加载时,用户可以登录.如果用户随后注销并重新登录,我的应用将崩溃,并显示以下错误:

I am using the iOS Parse SDK in my iPhone app. When the app first loads the user is able to log in. If the user then logs out and logs back in, my app crashes with the following error:

* 由于未捕获的异常"NSInternalInconsistencyException"而终止应用程序,原因:除非已通过登录或注册进行了身份验证,否则无法保存用户"

* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'User cannot be saved unless they have been authenticated via logIn or signUp'

我使用与Parse文档所说的用于登录和注销的相同代码. (此处的代码: https://parse.com/docs/ios_guide#fbusers/iOS )调用此AppDelegate.m方法后,该应用似乎崩溃了:

I use the same code that the Parse documentation says to use to login and logout. (code here: https://parse.com/docs/ios_guide#fbusers/iOS) The app seems to be crashing after this AppDelegate.m method is called:

- (void)applicationDidBecomeActive:(UIApplication *)application {
     [FBAppCall handleDidBecomeActiveWithSession:[PFFacebookUtils session]];
}

应用崩溃后,用户可以重新打开应用并成功重新登录.

After the app crashes, the user can reopen the app and re-login successfully.

请帮助?

推荐答案

尝试一下:

 - (void)applicationDidBecomeActive:(UIApplication *)application
   {
      [FBAppEvents activateApp];
      [FBAppCall handleDidBecomeActiveWithSession: [PFFacebookUtils session] ];
   }

您应该使用FBSession.activeSession只是为了确保FBAppCall获得与FBSession相同的实例,并为其获得结果.

You should use FBSession.activeSession just to ensure that the FBAppCall gets the same instance of FBSession, for which it has got the result.

这篇关于在iOS上解析SDK:"NSInternalInconsistencyException",原因:“除非已通过登录或注册进行了身份验证,否则无法保存用户"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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