lostinthebits
lostinthebits

Reputation: 661

Parse: log out anonymous user when user force terminates app

I log in as a guest user. I force quit the app (quickly press home button, swipe up on app - just to clarify). I re-start the app. The anonymous user is still logged in. I thought it would be as simple as this in my AppDelegate:

    func applicationWillTerminate(application: UIApplication) {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    PFUser.logOut()
}

Clearly, it is not. Do I need to set the PFUser.currentUser to nil in the applicationWillTerminate ? Or is there a better way to handle this scenario?

Upvotes: 0

Views: 737

Answers (1)

Aaron Brager
Aaron Brager

Reputation: 66242

Your app isn't informed if the user force quits your app. There's no way to do want you want (reliably).

As an alternative, you could log users out when the app launches.

Upvotes: 1

Related Questions