objective c - How to maintain Session for iphone -


In my iPhone app, after logging in user login user with user name and password, through that API Each feature can use features. But I want to maintain a session. That is, if the user is not doing anything in the app, after receiving 30 minutes, the session should end and the user should be asked to login with his username and password.

I am currently working on the same.

I do the following scenarios for the validity of the session:

  1. If the session token appears invalid after the first incoming request Given then I will try to quietly generate the session key again in the background.

  2. If method # 1 does not work for some reason as if the user has changed his password from somewhere, then I redirect the user to the login page and like I That "Your session key has expired, please log in again". To get more into this, I [[NSUser Defaults Standard User Defaults] by saving NSUserDefaults : Set Value: @ "ABCDEFGHIK" for KA: @ "Session"]; // key [[NSUserDefaults standard user default] stringforki: @ "session"];

    Hope it helps.

Comments