如何判断您的应用程序是使用 iCloud 架构开发还是生产
How to tell if you app is using iCloud schema development or production
我如何在运行时检查我的 iCloud 容器是连接到开发模式还是生产模式?
当 运行 通过模拟器时,这对我有用:
let path = "<pathToProjectDirectory>/<projectName>.entitlements"
guard let data = FileManager.default.contents(atPath: path) else { return }
do {
let dict = try PropertyListSerialization.propertyList(from: data, options: .mutableContainersAndLeaves, format: nil) as! [String : Any]
print( "container-environment: \(dict["com.apple.developer.icloud-container-environment"] ?? "no key")" )
}
catch {
// error
}
我如何在运行时检查我的 iCloud 容器是连接到开发模式还是生产模式?
当 运行 通过模拟器时,这对我有用:
let path = "<pathToProjectDirectory>/<projectName>.entitlements"
guard let data = FileManager.default.contents(atPath: path) else { return }
do {
let dict = try PropertyListSerialization.propertyList(from: data, options: .mutableContainersAndLeaves, format: nil) as! [String : Any]
print( "container-environment: \(dict["com.apple.developer.icloud-container-environment"] ?? "no key")" )
}
catch {
// error
}