Core Data结构修改,升级,迁移,后,在AppStore中更新升级crash的问题.
来源:互联网 发布:网上看房用什么软件 编辑:程序博客网 时间:2024/04/30 11:39
问题描述:
在苹果的错误收集中有这么一个问题:
使用的xmpp框架,在调整为适应ios5的版本后出现一个导致程序crash问题。但是原来的xmpp代码没有改变,那么问题在哪呢?
报错如下:
- BUG监听报告:
- 手机型号: iPhone OS , 版本: 4.3
- 程序名称: xxx, 版本:1.3
- 用户: xxx
- 2011-11-13 16:17:31.506 [11747:307] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a save operation.'
- *** Call stack at first throw:
- (
- 0 CoreFoundation 0x344aaed3 __exceptionPreprocess + 114
- 1 libobjc.A.dylib 0x33975811 objc_exception_throw + 24
- 2 CoreData 0x338f29c1 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 196
- 3 CoreData 0x3389253d -[NSManagedObjectContext save:] + 700
- 4 0x00045145 -[XMPPCapabilitiesCoreDataStorage setCapabilities:forHash:algorithm:] + 444
- 5 0x00042121 -[XMPPCapabilities xmppStream:willSendPresence:] + 232
- 6 0x0003ca57 -[XMPPStream sendElement:withTag:] + 342
- 7 0x0003c8f5 -[XMPPStream sendElement:] + 28
- 8 0x0004592f -[iPhoneXMPP goOnline] + 54
在stackoverflow找到解决办法:
http://stackoverflow.com/questions/1091228/i-keep-on-getting-save-operation-failure-after-any-change-on-my-xcode-data-mod
需要修改coredata的persistentstorecoordinator的代理实现方法,添加options,使得当coredata数据模型发生变化时,自动更该合并变化。
代码如下:
- - (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
- if (persistentStoreCoordinator != nil) {
- return persistentStoreCoordinator;
- }
- NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"database.sqlite"]];
- NSError *error = nil;
- NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
- [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
- persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: [self managedObjectModel]];
- if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:options error:&error]) {
- // Handle error
- }
- return persistentStoreCoordinator;
- }
- 转载自:http://blog.csdn.net/kepoon/article/details/7707850
更详细的,移步http://blog.csdn.net/chocolateloveme/article/details/40430385
0 0
- Core Data结构修改,升级,迁移,后,在AppStore中更新升级crash的问题.
- Core Data结构修改后,在AppStore中更新升级crash的问题.
- Core Data数据迁移与升级
- 升级Xcode8后的相机crash问题-IOS10权限问题
- 升级Xcode8后的相机crash问题-IOS10权限问题
- 升级Xcode8后的相机crash问题-IOS10权限问题
- Core Data 模型版本升级和数据迁移
- 升级Xcode8后的相机crash
- ios已上架的APP更新,使用core data的需要升级core Data数据库,这样做
- Core Data 模型版本升级和数据迁移(二)轻量级数据迁移
- Core Data 模型版本升级和数据迁移(四)迁移过程
- xUtils中的dbUtils中,在应用升级的时候修改表结构
- xUtils中的dbUtils中,在应用升级的时候修改表结构
- Kaili中MSF20150529升级更新后无法启动的解决办法
- WindowsXP升级后的问题
- oracle 升级后的问题
- Core Data 模型版本升级和数据迁移(一)简介
- Core Data 模型版本升级和数据迁移(三)映射概述
- 在XEN环境中实现VLAN
- 保罗·格雷厄姆创业讲堂二:团队与执行
- 解决java中ZipFile解压缩时候的中文路径和乱码问题
- scikit-learn使用joblib持久化模型过程中的问题详解
- shell资料
- Core Data结构修改,升级,迁移,后,在AppStore中更新升级crash的问题.
- codeforces 431B Shower Line
- 第9周项目1-利用循环程序求和B
- AIX上Sybase15的安装
- cocos2dx A* + tiledMap(改良升级)
- Matlab之BP神经网络反向传播算法
- poj2243 hdu1372 floyid warshall
- 大学规划
- ios 如何获取不变的UDID