草庐IT

addPersistentStoreWithType

全部标签

ios - 是否可以将 'force' 应用程序接受新模型版本,即使这意味着覆盖现有版本?

首先,我并不是100%了解CoreData,但我会尽力而为。所以我在更新应用程序时实现了轻量级迁移,但最近失败了,即应用程序在尝试访问本地数据库后崩溃。我目前假设原因是与模型版本有些混淆,但即使不是这样,我认为我的问题仍然有效:有没有办法在更新/升级应用程序时忽略核心数据迁移过程并强制应用程序使用最新的模型版本,即使它删除了本地用户数据?我的计划是,如果迁移失败,则强制将最新版本安装到设备上。这是比崩溃的应用程序更好的解决方案 最佳答案 迁移发生在addPersistentStoreWithType调用期间。所以如果失败了并且您想从

iOS:NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error 会导致什么错误:

我正在使用CoreData构建一个iOS应用程序。我的一小部分用户(大约1/1000)报告说应用程序在启动后不久就崩溃了。我怀疑持久存储协调器未能将数据库添加为持久存储。我无法重现测试中的任何错误,也无法从我的用户那里获得任何调试信息。有谁知道此方法产生的任何常见错误?-(NSPersistentStoreCoordinator*)persistentStoreCoordinator{if(persistentStoreCoordinator_!=nil)returnpersistentStoreCoordinator_;NSURL*storeURL=[[selfapplication

iphone - 使用 iCloud 时应用程序在 addPersistentStoreWithType 上停止

我的persistentStoreCoordinator中有以下代码。没有iCloud部分,它工作正常。对于iCloud,它会在addPersistentStoreWithType方法上停止。没有错误,它只是停止并且不会继续。有什么想法吗?-(NSPersistentStoreCoordinator*)persistentStoreCoordinator{if(_persistentStoreCoordinator!=nil){return_persistentStoreCoordinator;}NSURL*storeURL=[NSURLfileURLWithPath:STORE_PA

ios - 核心数据 : error: -addPersistentStoreWithType:SQLite configuration:(null)

每次我使用Xcode6在Simulator上安装应用程序时都会出现此错误2014-09-2711:25:01.286MyFace[2992:1780149]CoreData:error:-addPersistentStoreWithType:SQLiteconfiguration:(null)URL:file:///Users/douglasferreira/Library/Developer/CoreSimulator/Devices/DAC1BEDE-8673-471C-ADFD-923654C78719/data/Containers/Data/Application/D2213

ios - Core Data addPersistentStoreWithType 返回 nil,但错误也是 nil

我正在使用下面的代码创建一个NSPersistentStore。NSPersistentStore*pc=[persistentCoordinatoraddPersistentStoreWithType:EncryptedStoreTypeconfiguration:nilURL:databaseURLoptions:optionserror:error];if(*error){NSLog(@"Unabletoaddpersistentstore.");NSLog(@"Error:%@\n%@\n%@",*error,[*erroruserInfo],[*errorlocalizedD