IOS 9: Exclude iCloud Settings

Here is my problem: I am working on an application using CloudKit. I need to pass on the scenario that the user has not logged into iCloud on the device. I would like to send them to iCloud settings and remind them that iCloud data must be enabled for my application. I am using NSFileManager.defaultManager().ubiquityIdentityToken to decide if I need to open iCloud user settings. The problem is that I cannot understand how . What is the iCloud device settings url? I have done a lot of research and know that I do not want UIApplicationOpenSettingsURLString . This will open the application settings, not the device. This does not make it easier to work with the new iOS 9 security features, which, I think, I configured correctly:

enter image description here

+5
source share
1 answer

You can launch the iCloud section in the Settings app. I tested this on both iOS 9.3 and 10.2 .

The steps are as follows:

  • Add a new URL scheme to your application from the Project / Info / URL options.

enter image description here

  1. Now you can open the Settings / iCloud application using this code.

     let iCloudURL = URL(string: "App-prefs:root=CASTLE") if let settingsURL = iCloudURL { UIApplication.shared.openURL(settingsURL) } 

Note for iOS 10. *: The openURL method is actually deprecated, and you should use the open with complete method:

 open(_ url: URL, options: [String : Any] = [:], completionHandler completion: ((Bool) -> Void)? = nil) 

References

0
source

Source: https://habr.com/ru/post/1239595/


All Articles