I was wondering how to persist logins between app launches. It seems that it was working before (ParseUser.current wasn’t always nil on launch) but it seems to always be nil now.
Do you have more details about how its persisted and when its not? (i.e. does stopping the app in xcode destroys that session, etc).
It shouldn’t be. I don’t remember a time of it not persisting a user. The testcases check for persisting the sessionToken in the keychain, so if it would have broke, the testcases should have caught it.
I have the latest version in a couple of apps as well as my students use the latest version in their project apps and they haven’t reported any issues about the login not persisting to me.
What version are you using? Is this for iOS?
One thing could be, can you send how you initialize your client? For Linux or Android you will need to provide your own Key/Value Store as they don’t have a Keychain. so they can’t persist between logins on their own. If you are passing in your own store, data could possibly be saved incorrectly.
The majority of the User tests check to make sure the User/session is persisted to the Keychain (whether it’s through BaseParseUser.current (memory key/value store and keychain) or the keychain directly):
When it persists the only ways I can think when it wouldn’t survive an app relaunch is if:
Something is weird in my code base as my POUser.current is set within the login completion callback, but always nil, everywhere else. Actually… let me investigate more
What’s fishy is my isLoggedIn published bool… .current is accurate. Sorry for pointing the finger at your code, when I print POUser.current in the debugger it’s always nil.
Be sure to update to version 1.3.0 is there was a problem fixed where the objectId for ParseInstallation wasn’t being saved to the Keychain. This can cause issues when logging out and logging back in along with updating the Installation. If you use ParseInstallation, you can also remove the DispatchQueue closures that wraps around it (should be the only thing you have to change). Because of this, version 1.3.0 is the lowest version I recommend to use.
Each device gets an Installation automatically, so you are using it indirectly if you aren’t using it directly. You won’t see it in your Parse Dashboard until you “save”, but it’s in each devices Keychain when they initialize your app. If you decide to use push notifications, you will start using ParseInstallation directly. You can see more here: REST API Guide | Parse