简体   繁体   English

当前用户在iOS 7上杀死应用后无效

[英]Current User nil after kill app on iOS 7

I am coding an iOS app with parse SDK. 我正在使用解析SDK编写iOS应用。 I check user logged in by 我检查的用户登录

[PFUser currentUser] != nil

This is my case (on iPhone 5s, iOS 7.1): 这是我的情况(在iPhone 5s,iOS 7.1上):

  1. Open app. 开启应用程式。
  2. Login by account on parse database. 通过帐户登录解析数据库。
  3. Logged in success, with currentUser != nil 使用currentUser != nil成功登录
  4. On main screen (after login) I press iPhone's home button (2 times). 在主屏幕上(登录后),我按了iPhone的主页按钮(两次)。
  5. I kill the app 我杀了这个应用程序
  6. I open the app. 我打开应用程序。 And it not logged. 而且它没有记录。

I debug and see PFUser currentUser is nil when open app second time. 我进行调试,第二次打开应用程序时看到PFUser currentUsernil

I check it when the app is killed by user, and open again. 当应用程序被用户杀死时,我会对其进行检查,然后再次打开。 It works fine on iOS 8, but when I check on iOS 7.1, currentUser is nil . 它在iOS 8上运行良好,但是当我在iOS 7.1上进行检查时, currentUsernil It looks like it logged out automatic or currentUser did not save. 看起来它已自动注销或currentUser未保存。

I am using parse SDK 1.7.5. 我正在使用解析SDK 1.7.5。 A new version is 1.8.0, maybe I should update it? 新版本是1.8.0,也许我应该更新它?

Fixed. 固定。

This is my mistake, in AppDelegate I set rootViewController before Setup Parse and check currentUser in viewWillAppear . 这是我的错误,在AppDelegate我在Setup Parse之前Setup Parse rootViewController并在viewWillAppear检查currentUser I make this issue, maybe in iOS > 8.0 the viewWillAppear will be called slower on iOS 7.1. 我遇到了这个问题,也许在iOS> 8.0中, viewWillAppear在iOS 7.1上会变慢。

Every simulator you can use with XCode is its own "sand box" per se. 可以与XCode一起使用的每个模拟器本身就是其自己的“沙盒”。 This means that if I'm logged in as a user in Parse with the iPhone 6+ simulator using iOS 8.4, and then I shut down the simulator and run my app on the iPhone 6+ simulator using iOS 8.3 then the app shows that I'm no longer logged in. Try it for yourself. 这意味着,如果我使用iOS 8.4使用iPhone 6+模拟器以Parse用户身份登录,然后关闭模拟器并使用iOS 8.3在iPhone 6+模拟器上运行我的应用程序,则该应用程序显示我已不再登录。请自己尝试。 This is normal behavior. 这是正常现象。 If this is not what you are experiencing, then please elaborate your issue and explain in detail what actions you have taken in order to resolve this issue. 如果这不是您遇到的问题,请详细说明您的问题,并详细说明您为解决此问题而采取的措施。 Your issue could very well be caused by something entirely different that what I think it may be. 您的问题很可能是由与我认为完全不同的东西引起的。

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

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