【发布时间】:2012-01-23 11:07:43
【问题描述】:
我使用来自新的 CoreData Recipes 项目 (iPhoneCoreDataRecipes Sample Code) 的示例代码在现有 iOS 应用程序中构建 iCloud 同步,该应用程序使用 CoreData SQLite“数据库”并结合了非常复杂的数据模型,其中包含许多 -太多的关系(也许这是我的问题的部分原因,或者至少是一个提示)。
在此之前,应用程序运行良好,没有任何关于数据库的警告。但是现在,当我将实体添加到上下文或尝试保存它时,调试器会因为这样的错误而发疯:
+[PFUbiquityPeerRange(UbiquityMethods) peerRangeForLocalPrimaryKey:inStoreNamed:andEntityName:inManagedObjectContext:](71): CoreData: Ubiquity: Error or too many ranges for entity named: Room, ranges: (
"<PFUbiquityPeerRange: 0x627e0c0> (entity: PFUbiquityPeerRange; id: 0x627c830 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p12> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e300> (entity: PFUbiquityPeerRange; id: 0x627cfc0 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p13> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e350> (entity: PFUbiquityPeerRange; id: 0x627cfd0 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p21> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e3a0> (entity: PFUbiquityPeerRange; id: 0x627d300 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p42> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e3f0> (entity: PFUbiquityPeerRange; id: 0x627d310 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p49> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e440> (entity: PFUbiquityPeerRange; id: 0x627cea0 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p66> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e490> (entity: PFUbiquityPeerRange; id: 0x627ceb0 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p69> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e4e0> (entity: PFUbiquityPeerRange; id: 0x627cec0 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p75> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e530> (entity: PFUbiquityPeerRange; id: 0x627d120 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p82> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e580> (entity: PFUbiquityPeerRange; id: 0x627d130 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p94> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e5d0> (entity: PFUbiquityPeerRange; id: 0x627d140 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p96> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e620> (entity: PFUbiquityPeerRange; id: 0x627d150 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p97> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e670> (entity: PFUbiquityPeerRange; id: 0x627d160 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p132> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e6c0> (entity: PFUbiquityPeerRange; id: 0x627d170 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p140> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e710> (entity: PFUbiquityPeerRange; id: 0x627d180 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p156> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e760> (entity: PFUbiquityPeerRange; id: 0x627d190 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p157> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e7b0> (entity: PFUbiquityPeerRange; id: 0x627cd10 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p163> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e800> (entity: PFUbiquityPeerRange; id: 0x627cd20 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p177> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e850> (entity: PFUbiquityPeerRange; id: 0x627cd30 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p186> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e8a0> (entity: PFUbiquityPeerRange; id: 0x627cd40 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p192> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e8f0> (entity: PFUbiquityPeerRange; id: 0x627cd50 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p198> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e940> (entity: PFUbiquityPeerRange; id: 0x627cd60 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p199> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e990> (entity: PFUbiquityPeerRange; id: 0x627cd70 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p217> ; data: <fault>)",
"<PFUbiquityPeerRange: 0x627e9e0> (entity: PFUbiquityPeerRange; id: 0x627cd80 <x-coredata://A3F63A39-9034-4F81-8B35-911CC481B6C5/PFUbiquityPeerRange/p222> ; data: <fault>)")
, error: (null)
在抛出大量错误后,我收到内存警告,然后应用程序崩溃。我花了很多时间,但找不到关于 UbiquityMethods 添加的任何内容或找出错误的实际原因。再次重申:在使用 CoreData Recipes 示例项目中的代码创建 NSManagedObjectContext 和 NSPersistantStoreCoordinator 之前,该应用运行良好。
如果能提供任何帮助,我将不胜感激,当然,我会及时通知您有关该主题的最新信息!
最好的 本杰明
【问题讨论】:
-
您确定您已正确设置与 iCloud 的连接吗?查看这个 SO 问题 - stackoverflow.com/questions/7768528/… 它帮助我从 iCloud 获取更新(现在我正在努力合并从 iCloud 获得的更改)
标签: iphone ios core-data icloud