在 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/