I'm toying with iOS SDK, and I'm trying to change the device's date and time programmatically. I read that it's not possible with the standard SDK, which makes sense, but I'm wondering if it's possible to do so with the private APIs, as I'm just doing an app as a study, and do not intend to publish it on the App Store
相关问题
- 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
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
- Attempt to present UIAlertController on View Contr
1) Add to your app entitlements
com.apple.timed
key with bool value set toYES
2) Disable automatic time setting (and timezone if you want)
Link to private
CoreTime.framework
. Declare these functionsDisable automatic time setting
If you want to know in which state these settings are you can use these functions
3) Change current date and time
Declare these
This API is public in OS X so you can find documentation here https://developer.apple.com/library/ios/documentation/System/Conceptual/ManPages_iPhoneOS/man2/settimeofday.2.html
As an example we will set clock 10 minutes forward
4) Notify about date/time change