iosobjective-cswiftswift3icloud

url(forUbiquityContainerIdentifier) returns nil


I'm trying to get the url for my contrainer ID but the method keeps returning nil.

I've done the following:

My code is:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    //Override point for customization after application launch.

    let cloudURL = FileManager.default.url(forUbiquityContainerIdentifier: nil)
    print(cloudURL as Any)

    return false
}

I have looked for almost all of the questions that are related to this issue and tried the answers but it's not working.


Solution

  • For Xcode 9.2, checking this option worked: enter image description here