【问题标题】:How to tell if you app is using iCloud schema development or production如何判断您的应用程序是使用 iCloud 架构开发还是生产
【发布时间】:2018-06-04 12:13:10
【问题描述】:

如何在运行时检查我的 iCloud 容器是否连接到开发或生产架构?

【问题讨论】:

  • 仅用于调试信息。

标签: ios macos cocoa-touch cloudkit


【解决方案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
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-28
    • 1970-01-01
    • 2010-09-20
    相关资源
    最近更新 更多