I am wondering what the best way is to detect a changed iCloud user account when the the app was force quit by the user.
When the app is in the background and the user changes their iCloud account, a notification 'CKAccountChanged' is sent by the time the app enters the foreground so it can be handled. OK.
BUT what if the app was force quit by the user?
My approach is to store the user token locally. At the next app launch, the user token is retrieved and checked against the locally saved one.
Is there a "nicer" way?
Related
For fcm (Firebase Could messaging), We get a token using getToken()
I want to know,
Is the token generate one time
or
Is the token generate every time user login?
The registration token may change when:
The app is restored on a new device
The user uninstalls/reinstall the app
The user clears app data.
More :
Update from Play Store - Token remains same.
When close the application and reopen it - Token remains same.
If you want to call onTokenRefreshed() you should do it manually.
Learn more - https://firebase.google.com/docs/cloud-messaging/android/client
Additionally,
I recommend you should record that token for the user every time your app launches. Then, you don't face any problems.
I'm creating an app both for android and IOS, the first time the user starts the app he'll be presented with a login screen, the server with all the credentials is already up so I just need to send through POST method username and password and check the server response (success or failure), then If the username and password are correct I was thinking about saving them in the NSUserDefaults and everytime the user opens the app I won't show them the login screen again but as a background task the app will retrieve the credentials from the NSUserDefaults and send them again to the server (It may return failure if the user has been eliminated or has changed his password), I just wanted to know: is this the right approach to this problem?
I'm trying to delete the user's login credentials and push notifications permissions from my test iPhone 4.
When I delete the app, it still remembers the user's login credentials, and it doesn't reset the push notification opt-in permissions.
How can I reset this data?
These are two separate problems.
For the login problem, sounds like you're storing the user's login credentials on the keychain. The only way to wipe this out is to either do it via code, logging out and then deleting the app, or doing a factory reset on the device.
About resetting the push notification status, it's mentioned in an Apple Technical Note here:
https://developer.apple.com/library/ios/technotes/tn2265/_index.html
Scroll down to "Resetting the Push Notifications Permissions Alert on iOS"
May be it will be a too startup question.
We have developed an iPhone application and its uploaded in the Appstore. We have our own login mechanism, facabook login, and twitter login. Our users reporting an issue that, when the app is started and the iphone device is restarted (switched off), the application is also logged out. And users needs to login again. We have checked Facebook app. It keeps logged in when the device is restarted (switched off). We also want to do like that. Can you have suggest mechanism to do like that.
Store the Username and password in the keychain. When the app starts up, then grab the username and password from the keychain and execute the method for login.
John
You can can Store your acessToken (facebook) with NSUserDefaults, CoreData or FileSystem. I will not suggest you to save your login/password inside your app. If you need to do this, its better save data user(name,address,celphone...) but not the access, like login/password. Its more safe. Of course, you can use KeyChain, but will each in what are you thinking doing with the app.
NSUserDefaults
Save string to the NSUserDefaults?
File System - apple guide
http://developer.apple.com/library/mac/#documentation/FileManagement/Conceptual/FileSystemProgrammingGUide/FileSystemOverview/FileSystemOverview.html
Core Data
Save and Load Data - CoreData
I'm creating an iPhone app with a ROR 3 backend. I'm just wondering about the best practices with regards to user sessions and session tokens. I would like to design the app such that after an initial registration, the user is always logged in. Is this best done by saving the username and password in NSUserDefaults and automatically logging in behind the scenes when the app launches and using the generated token (stored in the delegate?) for all the operations.. and then basically every time the app launches, a new token is generated.
Or, upon the initial registration, save the token in NSUserDefaults and use that token with every launch?
Thank you and best regards!