Reputation: 2513
I'm trying to get the url for my contrainer ID but the method keeps returning nil
.
I've done the following:
iCloud Key-Value Store
is added to the entitlements file.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.
Upvotes: 5
Views: 4043
Reputation: 2152
I had same problem, fix it by following steps: 1.go to physical device's setting -> iCloud. turn off iCloud Drive and turn it on again, find your app in iCloud Drive, turn off and turn on. 2.shut down your device, and restart it.
Then it worked, I'm not sure which part make it worked, hope for help.
Upvotes: 2
Reputation: 8322
Try this :
Inside the Settings app, under the 'iCloud' menu. I noticed that 'Documents & Data' was set to Off.
Solution was to change ('Documents & Data' to 'On'.
Upvotes: 2