重定向到应用程序委托的核心数据崩溃persistentStoreCoordinator mathod

时间:2015-04-24 15:19:20

标签: ios objective-c sqlite core-data crashlytics

大家好,我正在尝试将核心数据从我的应用程序实施到表格视图中,以避免不必要的互联网流量,问题在于我是核心数据的新手,也是在实施开始时。

所以在这里你有我的核心数据实体以及它的外观:

entity model

我只使用一个实体,你可以在照片中看到模型,也可以使用NSmanagedObjectSubclass。

我在做的是: 1.我从互联网下载XML并保存在NSUserDefaults中以获得更好的持久性,因此如果第一次启动应用程序,我会检查NSUserDefaults是否存在,而不是我在viewDiaAppear中再次下载它,如果是我第一次在viewDidLoad中下载数据。 因此,第一次创建数据并在表视图中检索它可以正常工作 3.但是,当应用程序启动第二个时,它会在其中一个女巫点上粉碎一系列条件,我不确定,所以我添加了CrashLitiscs,这就是我得到的:< / p>

crash report in Crashlytics

但是在指定的行上我没有数组,不仅在那一行,而且在上面或下面的那条线附近也没有。

这些是来自Crashlytics

的代码
//check ID
if ([NSString stringWithFormat:@"%d", count] != suggestedEntityForGroup.groupName) {
    //replace with new data
    suggestedEntityForGroup.groupID = [NSString stringWithFormat:@"%d",count];
    NSError *managedObjError = nil;
    if (![[self appDelegate].managedObjectContext save:&managedObjError]) {
        NSLog(@"Next error ocured:%@ while updating group id at position:%d", managedObjError, count);
    }
}

以下是检索XML后处理核心数据DB的整个code

这是崩溃后的控制台日志:

CoreData:错误:-addPersistentStoreWithType:SQLite配置:(null)URL:file:/// Users / laurentiu / Library / Developer / CoreSimulator / Devices / 1F02B530-AB90-4B1B-BBAA-08B3B9C14ECA / data /容器/数据/应用/ 668593BE-16B2-419E-ACB9-95FB38A8A90B / Documents / ChannerApp.sqlite选项:{         NSInferMappingModelAutomaticallyOption = 1;         NSMigratePersistentStoresAutomaticallyOption = 1;     } ...返回错误错误Domain = NSCocoaErrorDomain Code = 134130&#34;操作无法完成。 (可可错误134130。)&#34; UserInfo = 0x7fa4d600ce70 {URL = file:/// Users / laurentiu / Library / Developer / CoreSimulator / Devices / 1F02B530-AB90-4B1B-BBAA-08B3B9C14ECA / data / Containers / Data / Application / 668593BE-16B2-419E-ACB9-95FB38A8A90B /Documents/ChannerApp.sqlite,metadata = {         NSPersistenceFrameworkVersion = 519;         NSStoreModelVersionHashes = {             Asd =&lt; 6acf157c fdf3a06b 00e10f78 074562df 987e2334 be30294e ae73e5c1 cdc1f9b1&gt ;;             SuggestedChannelsEntity =;         };         NSStoreModelVersionHashesVersion = 3;         NSStoreModelVersionIdentifiers =(             &#34;&#34;         );         NSStoreType = SQLite;         NSStoreUUID =&#34; D73CCCB1-F3AE-4153-83AE-2D1B6D91E3D9&#34 ;;         &#34; _NSAutoVacuumLevel&#34; = 2;     },reason =无法使用userInfo字典{找到源存储的模型} {         URL =&#34; file:/// Users / laurentiu / Library / Developer / CoreSimulator / Devices / 1F02B530-AB90-4B1B-BBAA-08B3B9C14ECA / data / Containers / Data / Application / 668593BE-16B2-419E-ACB9-95FB38A8A90B /Documents/ChannerApp.sqlite" ;;         metadata = {             NSPersistenceFrameworkVersion = 519;             NSStoreModelVersionHashes = {                 Asd =&lt; 6acf157c fdf3a06b 00e10f78 074562df 987e2334 be30294e ae73e5c1 cdc1f9b1&gt ;;                 SuggestedChannelsEntity =;             };             NSStoreModelVersionHashesVersion = 3;             NSStoreModelVersionIdentifiers =(                 &#34;&#34;             );             NSStoreType = SQLite;             NSStoreUUID =&#34; D73CCCB1-F3AE-4153-83AE-2D1B6D91E3D9&#34 ;;             &#34; _NSAutoVacuumLevel&#34; = 2;         };         reason =&#34;无法找到源存储的模型&#34 ;;     }     2015-04-24 17:45:34.467 ChannerApp [11021:412450] CoreData:注释:NSPersistentStoreCoordinator的当前模型哈希是{         SuggestedChannelsEntity =;     }     2015-04-24 17:45:34.468 ChannerApp [11021:412450]未解决的错误错误域= YOUR_ERROR_DOMAIN代码= 9999&#34;无法初始化应用程序保存的数据&#34; UserInfo = 0x7fa4d3c9e0c0 {NSLocalizedFailureReason =创建或加载应用程序保存的数据时出错。,NSLocalizedDescription =无法初始化应用程序保存的数据,NSUnderlyingError = 0x7fa4d600e2c0&#34;操作无法进行完成。 (可可错误134130。)&#34;},{         NSLocalizedDescription =&#34;无法初始化应用程序保存的数据&#34 ;;         NSLocalizedFailureReason =&#34;创建或加载应用程序保存的数据时出错。&#34 ;;         NSUnderlyingError =&#34;错误域= NSCocoaErrorDomain代码= 134130 \&#34;操作无法完成。 (可可错误134130。)\&#34; UserInfo = 0x7fa4d600ce70 {URL = file:/// Users / laurentiu / Library / Developer / CoreSimulator / Devices / 1F02B530-AB90-4B1B-BBAA-08B3B9C14ECA / data / Containers / Data / Application / 668593BE-16B2-419E-ACB9-95FB38A8A90B /Documents/ChannerApp.sqlite,metadata = {\ n NSPersistenceFrameworkVersion = 519; \ n NSStoreModelVersionHashes = {\ n Asd =&lt; 6acf157c fdf3a06b 00e10f78 074562df 987e2334 be30294e ae73e5c1 cdc1f9b1&gt;; \ n SuggestedChannelsEntity =; \ n}; \ n NSStoreModelVersionHashesVersion = 3; \ n NSStoreModelVersionIdentifiers =(\ n \&#34; \&#34; \ n); \ n NSStoreType = SQLite; \ n NSStoreUUID = \&#34; D73CCCB1-F3AE-4153-83AE-2D1B6D91E3D9 \&# 34 ;; \ n \&#34; _NSAutoVacuumLevel \&#34; = 2; \ n},reason =无法找到源存储的模型}&#34 ;;     }

0 个答案:

没有答案