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