【发布时间】:2016-01-16 00:48:06
【问题描述】:
每次我尝试使用 iCloud 键值存储为键设置值时,我的应用程序都会崩溃...
我收到此错误:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSUbiquitousKeyValueStore 0x13fd5b8a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key ladies.'
*** First throw call stack:
(0x1842f0f48 0x19979bf80 0x1842f0c08 0x18516c014 0x1000e5380 0x1000e9914 0x1000f0430 0x1000f046c 0x1000f04a0 0x1000f04e4 0x1898bf240 0x1898bed3c 0x1898bebc4 0x189085c2c 0x101429c68 0x10142f710 0x1842a81f8 0x1842a6060 0x1841d4ca0 0x18f758088 0x1898ecffc 0x1000f4564 0x199fde8b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
我定义了我的密钥库:
var iCloudStore = NSUbiquitousKeyValueStore.defaultStore()
这样设置我的值:
iCloudStore.setValue(experience, forKey: "experience")
为什么这不起作用?我是否必须定义该密钥才能使其工作?我真的不明白我得到的错误......
【问题讨论】: