I am trying to open the user's iCloud settings through my iOS App. Currently, I have this:
@IBAction func openSettings(_ sender: AnyObject) {
guard let settingsUrl = URL(string: UIApplicationOpenSettingsURLString) else {
return
}
if UIApplication.shared.canOpenURL(settingsUrl) {
UIApplication.shared.openURL(settingsUrl)
}
}
However, this opens the app's . How can I open the user's iCloud settings? Thanks!
Try this:
let settingsCloudKitURL = URL(string: "App-Prefs:root=CASTLE")
if let url = settingsCloudKitURL, UIApplication.shared.canOpenURL(url) {
if #available(iOS 10, *) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(url)
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.