1

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!

Pranav Wadhwa
  • 7,666
  • 6
  • 39
  • 61

1 Answers1

-1

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)
    }
}
eMdOS
  • 1,693
  • 18
  • 23
  • 1
    App will rejected by AppStore if u are use "App-Prefs:root=CASTLE" – AleyRobotics Nov 07 '18 at 07:41
  • 2
    "App-Prefs:root=CASTLE" URL is non-public APIs and is not permitted on the App Store because it can lead to a poor user experience should these APIs change. – AleyRobotics Nov 07 '18 at 07:50
  • Has this now changed as of iOS 13.1, just saw this article: [link](https://www.macstories.net/ios/a-comprehensive-guide-to-all-120-settings-urls-supported-by-ios-and-ipados-13-1/) – Halford May 03 '21 at 20:39