【发布时间】:2018-06-04 12:13:10
【问题描述】:
如何在运行时检查我的 iCloud 容器是否连接到开发或生产架构?
【问题讨论】:
-
仅用于调试信息。
标签: ios macos cocoa-touch cloudkit
如何在运行时检查我的 iCloud 容器是否连接到开发或生产架构?
【问题讨论】:
标签: ios macos cocoa-touch cloudkit
通过模拟器运行时这对我有用:
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
}
【讨论】: