在iOS中固定时间后注销App

时间:2021-06-10 01:18:01

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

大家好我是iOS编程的新手请帮助我.....提前感谢..我想在我的应用程序中添加注销功能,以便用户在登录时间(2小时)的固定间隔后退出。请建议我实现此功能的方法

2 个解决方案

#1


0  

you can implement this functionality using NSTimer

您可以使用NSTimer实现此功能

[NSTimer scheduledTimerWithTimeInterval:@"time" target:self selector:@selector(targetMethod:) userInfo:nil repeats:NO];

-(void)targetMethod
 {
      //enter code here`
 }

#2


0  

Check out the accepted answer on this question. It should answer your question.

查看此问题的已接受答案。它应该回答你的问题。

iPhone: Detecting user inactivity/idle time since last screen touch

iPhone:检测自上次屏幕触摸后用户不活动/空闲时间

EDIT:

编辑:

you can use the NSTimer class

你可以使用NSTimer类

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。看起来你正在寻找一个非常基本的实现,你通常会使用它

NSTimer scheduledTimerWithTimeInterval...

method

方法

#1


0  

you can implement this functionality using NSTimer

您可以使用NSTimer实现此功能

[NSTimer scheduledTimerWithTimeInterval:@"time" target:self selector:@selector(targetMethod:) userInfo:nil repeats:NO];

-(void)targetMethod
 {
      //enter code here`
 }

#2


0  

Check out the accepted answer on this question. It should answer your question.

查看此问题的已接受答案。它应该回答你的问题。

iPhone: Detecting user inactivity/idle time since last screen touch

iPhone:检测自上次屏幕触摸后用户不活动/空闲时间

EDIT:

编辑:

you can use the NSTimer class

你可以使用NSTimer类

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。看起来你正在寻找一个非常基本的实现,你通常会使用它

NSTimer scheduledTimerWithTimeInterval...

method

方法