Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我们的应用程序中,如果用户一周未登录,我们必须自动注销用户。
安排它的最佳方法是什么?我使用NSTimer的时间间隔为 (24*7*60*60) 会有效吗?
NSTimer
NB:终止应用程序后将自动显示登录屏幕。所以只有当应用最小化一周时才会出现这种情况
当应用程序在后台时,NSTimer 会暂停。您的用户很有可能运行其他应用程序,因此您的应用程序将进入后台。
我会像这样解决问题
NSDate
NSUserDefault