I am working on an alarm app, which needs to auto-lock the device after a particular time period, since most of the clock applications in the App Store have that feature.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
- How can I add media attachments to my push notific
If you would like to lock the phone after 5 minutes then do the following:
set this:
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
and also set a timer:
[NSTimer scheduledTimerWithTimeInterval:240 target:self selector:@selector(disableIdleTimer) userInfo:nil repeats:NO];
And in the disableIdleTimer method you will set this:
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
This will work with the following condition: the iPhone's autolock function is set to the minimum (1 minute).
As I see in the moment, there is no better method.