Parse SDK on iOS: 'NSInternalInconsistencyException', reason: 'User cannot be saved unless they have been authenticated via logIn or signUp'

孤街醉人 提交于 2019-12-24 03:51:20

问题


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:

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

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.

Help please?


回答1:


Try this:

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

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



来源:https://stackoverflow.com/questions/25707282/parse-sdk-on-ios-nsinternalinconsistencyexception-reason-user-cannot-be-sa

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