Here is my problem: I am working on an app that uses CloudKit. I need to hand the scenario that the user is not logged in to iCloud on the device. I would like to send them to the iCloud settings, and remind them that iCloud data needs to be turned on for my app. I am using NSFileManager.defaultManager().ubiquityIdentityToken
to decide if I need to open the user's iCloud settings. The problem is, I can't figure out how. What is the URL for the device's iCloud settings? I have done a lot of research, and know I do not want UIApplicationOpenSettingsURLString
. This open's the app's settings, not the devices. This is not made any easier with iOS 9's new security features, which I think I have set up properly:
You can launch iCloud section of the Settings App. I have tested this both on iOS 9.3 and 10.2.
The steps are as follows:
Now, you can open Settings/iCloud app with this code.
let iCloudURL = URL(string: "App-prefs:root=CASTLE")
if let settingsURL = iCloudURL {
UIApplication.shared.openURL(settingsURL)
}
Note for iOS 10.*: openURL
method is actually deprecated and you should use the open with completion handler method:
open(_ url: URL,
options: [String : Any] = [:],
completionHandler completion: ((Bool) -> Void)? = nil)
References
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With