我正在尝试获取我的容器 ID 的 url,但该方法一直返回 nil
。
我做了以下事情:
- 在 Xcode 功能中启用 iCloud 键值存储。
- 在物理设备上进行测试。
- iCloud 和 iCloud Drive 在物理设备中打开。
- 确保将
iCloud Key-Value Store
添加到权利文件中。
我的代码是:
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
}
我已经查找了与此问题相关的几乎所有问题并尝试了答案,但它不起作用。
最佳答案
关于ios - url(forUbiquityContainerIdentifier) 返回 nil,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43673007/