hi all i am new to the iOS programming please help me..... Thanks in advance.. I want to add logout functionality in my app, so that user get logout after fixed interval from login time(2 hrs). Please suggest me the way to implement this functionality
Asked
Active
Viewed 737 times
2 Answers
0
Check out the accepted answer on this question. It should answer your question.
iPhone: Detecting user inactivity/idle time since last screen touch
EDIT:
you can use the NSTimer class
This question will help you with NSTimer. It seems like you are looking for a pretty basic implementation of it in which You would usually use the
NSTimer scheduledTimerWithTimeInterval...
method
-
thanks for your reply but this will logout if your remain inactive for certain period, but i also want to logout user if he is using the app i.e. logout after 2 hrs from login time – rocky171 Oct 05 '14 at 02:01
-
thanks NewEngland its will work, but i have 1 question can i do the same thing with uilocalnotification? – rocky171 Oct 05 '14 at 02:15
-
UILocalNotification is better for when your app is running in the background(or while screen is off). but you should still use NSTimer when your app is in the foreground – MendyK Oct 05 '14 at 03:00
0
you can implement this functionality using NSTimer
[NSTimer scheduledTimerWithTimeInterval:@"time" target:self selector:@selector(targetMethod:) userInfo:nil repeats:NO];
-(void)targetMethod
{
//enter code here`
}

Lineesh K Mohan
- 1,702
- 14
- 18