Application session in iOS? - iphone

I need to create a "login application" but I don't know about session in iOS. My application need login to my website (PHP based website) to get data. Can anybody tell me how to create and manage application session in iOS app? Thanks!

There's no concept of web/browser session (whatever that means to you) in iOS. iOS applications are just launched when a user touches the icon, and are quit when the user quit them.
Typically you require the user to input the login id and the password when the app is launched, and you create a web/server/browser session by accessing the web server. You can keep the id and the password securely inside in the storage of the iPhone, so that the user doesn't need to input them again and again whenever the program is launched.

Related

iOS app needs logged in after iphone restart

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

Save Spotify logged in user session in iPhone

I am implementing Spotify in iPhone. After the user is logged in to the Spotify in my application, I want to keep the user as logged in until he click logout button, ie, even after the application terminate and relaunch, I should get the session. How can we implement it. Please help.
You need to read this Forum
Save Spotify Session
And also read remember credentials
Enjoy Programming

How do I listen for a Facebook app uninstall?

When a Facebook user logins with our Facebook application we register him in our database as a member. But if, sometime in the future, the user wishes to not be a member of the application and uninstalls the app, how can I tell so we can remove him from our database? In other words, how can I learn of an uninstall so I can handle the event appropriately on our side?
If the user deauthorizes your app, Facebook „pings” the deauthorize callback you can specify in your app settings. That gives you a chance to to deal with this event accordingly on your server.

How does iPhone app remember me feature works?

I developed an iPhone app. User need to log in to update their credentials. I'm using iOS Keychain feature to store the username and password. So, next time user launch the app user will be logged in. I would like to add remember me feature in my app. So, user will have an option to check the remember me or not.
My question is if the user don't want to remember his credentials, when I'm suppose to clear the keychain? How do I know if the app is closing/shutdown?
– applicationWillResignActive:
– applicationDidEnterBackground:
These two methods are called depending on the situation when the app enters background.(sleep button/phone call etc).
You can look it up in the docs.
https://developer.apple.com/library/IOs/#documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UIApplicationDelegate
You meed to write the login credentials to application preferences.
(Here is how to read write to iPhone app preference)
http://knol.google.com/k/iphone-sdk-application-preferences#
Also here is how to read default preferences
http://www.redcodelabs.com/2009/07/read-iphone-preferences/

iPhone app token session with the backend

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!