我使用 iCloud 存储 iPad 应用程序的核心数据信息。我使用Magical Record提供的辅助方法来处理与 Core Data 相关的所有内容。
昨天我的应用程序在访问 Core Data 时开始表现得很奇怪。即使数据库完全为空(应用程序的全新安装),应用程序也会完全冻结并花费大量时间加载。等待几分钟后,它会给出一个错误,说 iCloud 已超时。给出了以下错误:
-[PFUbiquitySafeSaveFile waitForFileToUpload:](268): CoreData: Ubiquity: <PFUbiquityPeerReceipt: 0x1f85c580>(0)
permanentLocation: <PFUbiquityLocation: 0x1f85c5d0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/receipt.0.cdt
safeLocation: <PFUbiquityLocation: 0x1f85ce30>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C.0.cdt
currentLocation: <PFUbiquityLocation: 0x1f85ce30>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C.0.cdt
kv: (null)
Safe save failed for file, error: Error Domain=NSCocoaErrorDomain Code=512 "The file upload timed out." UserInfo=0x1f85d520 {NSLocalizedDescription=The file upload timed out.}
2013-01-03 16:03:35.276 MyAppName[188:1503] +[MagicalRecord(ErrorHandling) defaultErrorHandler:](0x12059c) Error: The file upload timed out.
2013-01-03 16:03:35.277 MyAppName[188:1503] +[MagicalRecord(ErrorHandling) defaultErrorHandler:](0x12059c) Error Message: The file upload timed out.
2013-01-03 16:03:35.278 MyAppName[188:1503] +[MagicalRecord(ErrorHandling) defaultErrorHandler:](0x12059c) Error Domain: NSCocoaErrorDomain
2013-01-03 16:03:35.280 MyAppName[188:1503] +[MagicalRecord(ErrorHandling) defaultErrorHandler:](0x12059c) Recovery Suggestion: (null)
2013-01-03 16:03:35.296 MyAppName[188:907] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(0x3ade92a3 0x356bf97f 0x3ad33e8d 0xb3db3 0x35e3f11f 0x35e3e4b7 0x35e431bd 0x3adbcf3b 0x3ad2febd 0x3ad2fd49 0x3a4b72eb 0x36879301 0x4fa7d 0x4fa18)
libc++abi.dylib: terminate called throwing an exception
(lldb)
我读了几篇帖子说 iCloud 可能会表现得很奇怪,最好还是等一下。这就是我所做的,当我今天在 18 小时后尝试时,或多或少发生了同样的事情。
首先,当我启动应用程序时,它给了我另一个错误。启动应用程序时会发生这种情况,因为我在-application:didFinishLaunchingWithOptions:
. 我收到以下错误:
-[_PFUbiquityRecordsImporter rollResponseOperation:encounteredAnError:whileTryingToAdoptBaseline:](1509): CoreData: Ubiquity: <PFUbiquityBaselineRollResponseOperation: 0x1e0b3540> localPeerID: mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C, storeName: com.mydomain.MyAppName, modelVersionHash: HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=
ubiquityRootLocation: <PFUbiquityLocation: 0x1cdb8650>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName
Encountered an error while trying to respond to the roll of baseline: <PFUbiquityBaseline: 0x1e0b4aa0>(0)
permanentLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip
safeLocation: <PFUbiquityLocation: 0x1e0b33a0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C
currentLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip
storeName: com.mydomain.MyAppName
modelVersionHash: HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=
baselineArchiveLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip
Error: Error Domain=NSCocoaErrorDomain Code=134310 "The operation couldn’t be completed. (Cocoa error 134310.)" UserInfo=0x1e0b8c40 {baseline=<PFUbiquityBaseline: 0x1e0b4aa0>(0)
permanentLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip
safeLocation: <PFUbiquityLocation: 0x1e0b33a0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C
currentLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip
storeName: com.mydomain.MyAppName
modelVersionHash: HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=
baselineArchiveLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip
, localStoreKV=<PFUbiquityKnowledgeVector: 0x1e0b90c0> ()}
userInfo: {
baseline = "<PFUbiquityBaseline: 0x1e0b4aa0>(0)\n\tpermanentLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip\n\tsafeLocation: <PFUbiquityLocation: 0x1e0b33a0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/mobile.D2EB3F30-70E9-5405-931D-B7217274BA1C\n\tcurrentLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip\n\n\tstoreName: com.mydomain.MyAppName\n\tmodelVersionHash: HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=\n\tbaselineArchiveLocation: <PFUbiquityLocation: 0x1e0ab2e0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~mydomain~MyAppName/.baseline/com.mydomain.MyAppName/HExUvqv20os5L2c5u1DeTzBs3lEpOwzkgw1MsXYupPg=/baseline.zip\n";
localStoreKV = "<PFUbiquityKnowledgeVector: 0x1e0b90c0> ()";
}
现在,在尝试了论坛上提到的几种解决方案(例如清理构建、重新安装应用程序、删除 iCloud 数据等)后,我得到了与昨天相同的错误。
我真的无法弄清楚为什么会发生这种情况。我不记得对 iCloud 配置做过任何事情。我已经更新了我的数据模型,但是在完成应用程序的全新安装、删除所有以前的 iCloud 数据等之后,这并不重要。
我希望有人可以帮助我更接近为什么会发生这些错误。