ios - 在 iOS 7 设备的 CKContainer.defaultContainer() 处中断

标签 ios cloudkit

在 ios 7 设备上调试应用程序时,我收到以下中断,尽管它适用于 ios 8 设备:

 (lldb) bt
* thread #1: tid = 0xbb78, 0x002094e2 libswiftCore.dylib`swift_getObjCClassMetadata + 10, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)

代码中突出显示的部分如下:

class CloudKitHelper {
    var container : CKContainer
    var publicDB : CKDatabase
    let privateDB : CKDatabase
    var delegate : CloudKitDelegate?
    var todos = [Todos]()

    class func sharedInstance() -> CloudKitHelper {
        return cloudKitHelper
    }

    init() {
        container = CKContainer.defaultContainer() // here the break is shown
        publicDB = container.publicCloudDatabase
        privateDB = container.privateCloudDatabase
    }

为 ios 7 和 8 声明 defaultcontainer 有什么区别吗?

最佳答案

CloudKit 需要 iOS 8。以下是 iOS 8 中可用的新 API 的高级列表:https://developer.apple.com/ios8/

如果某项功能需要的 iOS 版本高于您想要的目标版本,您可以将该功能设为可选。这将需要额外的代码来在运行之前检查可用的功能。

关于ios - 在 iOS 7 设备的 CKContainer.defaultContainer() 处中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26385095/

相关文章:

ios - UICollectionView 标题重复每一行

ios - 验证 iOS 的 url 以 www 开头

ios - 两个 Segue 从一个 View Controller 传递相同的数据

swift - 如何通过 CKRecordID 获取 AppleID?

c# - 使用 .pem 证书注册 Apple 服务

ios - 如何在ios中旋转APP委托(delegate)窗口的标签?

ios - 不受我控制的应用程序是否可以访问存储在我帐户中的 iCloud/CloudKit 数据?

swift - CloudKit中的Core Data发生变化时如何调用WidgetCenter.shared.reloadAllTimelines()?

ios - 为什么 "self"在我的 QueryOperation 中阻止来自 CloudKit 的数据

ios - 如果 Swift 中存在 NSUserDefault 则尝试更新 CLLocation