如果我的iCloud容器连接到开发或生产架构,我如何在运行时检查?
答案 0 :(得分:1)
当通过模拟器运行时,这对我有用:
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
}