使用CoreData与iCloud的奇怪错误 [英] Weird Errors using CoreData with iCloud

查看:187
本文介绍了使用CoreData与iCloud的奇怪错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了来自新的CoreData Recipes项目的示例代码( iPhoneCoreDataRecipes示例代码)在现有的iOS应用程序中构建iCloud同步,该应用程序使用CoreData SQLite数据库结合具有许多多对多关系的非常复杂的数据模型(也许这是我的问题的原因的一部分,至少一个提示)。

I used the sample code from the new CoreData Recipes project (iPhoneCoreDataRecipes Sample Code) to build in iCloud syncing in an existing iOS application which uses a CoreData SQLite "Database" in combination with a very complex data model with lots of many-too-many-relationships (Maybe this is part of the cause of my problem or at least a hint).

之前,应用程序工作正常,没有关于数据库的任何警告。但现在,当我向上下文添加实体或尝试保存时,调试器会出现这样的错误:

Before that the application worked fine without any warnings regarding the database. But now the debugger goes crazy with errors like this when I add entities to the context or try to save it:

+[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的应用程序工作很好。

After throwing lot's of errors, I receive a memory warning and then the app crashes. I spent lots of hours but can't find anything about the UbiquityMethods additions or figure out the actual cause of the errors. Again: Before using the code from the CoreData Recipes sample project for creating the NSManagedObjectContext and the NSPersistantStoreCoordinator the app worked just fine.

我会感谢任何帮助,当然我会告诉你最新的话题。

I'd appreciate any help and of course I will keep you up to date on the topic!

最好的
Benjamin

Best Benjamin

推荐答案

检查您在授权文件中正确设置密钥并为NSPersistentStoreUbiquitousContentNameKey和NSPersistentStoreUbiquitousContentURLKey键设置正确的值NSPersistentStoreCoordinator实例。请参阅我没有获取NSPersistentStoreDidImportUbiquitousContentChangesNotification(带代码示例)示例

Check that you are correctly setting keys in your entitlements file and set correct values for NSPersistentStoreUbiquitousContentNameKey and NSPersistentStoreUbiquitousContentURLKey keys when configuring your NSPersistentStoreCoordinator instance. see I'm not getting the NSPersistentStoreDidImportUbiquitousContentChangesNotification (with code sample) for sample

这篇关于使用CoreData与iCloud的奇怪错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆