Reputation: 29
I would like to keep a user logged into an app even if they double click the home button and swipe my app away (force close). Similar to how snapchat is.
I would like them to only be able to logout if they personally click the logout button.
How can i implement this?
I am using Swift and Parse. Thank you.
Upvotes: 0
Views: 1547
Reputation: 33979
There is no way to keep an app running if the app is force closed, but that doesn't mean you have to log the user out.
The standard way to handle this is to store the authorization token/info so that if the app is killed and restarted, then it will act exactly as if it was always logged in.
Upvotes: 1
Reputation: 12053
The iOS Keychain is a good option. Since maintaining a session means keeping a session token of some kind, NSUserDefaults
is not secure and would not be the way to go.
Upvotes: 1