开发者

Automatically exit my application after 10 minutes of non interactions

An example would be if a user sat their 开发者_Go百科phone down with my application open and running but there had been no interactions with the application in the last ten minutes, the user should be logged out and have to sign in again. Is this a parameter that can be defined?


There is no pre-defined parameter. You have to check yourself using a timer method and/or by recording the time of the last user interaction.

It's perfectly legal for an app to display its login UIView (again) after 10 minutes, but don't try to exit the app instead.


Quitting an active app, without user action/notification is considered bad form. However, if you must...

  1. When your application starts, start a timer (NSTimer).

  2. Instrument every method in your application to call a timer_reset function.

  3. After 10 minutes call exit (0);

Have a look at the various NSTimer methods.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜