Ios &引用;Can';“找不到源存储的模型”;发生在iphone期间;“自动轻量级迁移”;?
我真的被iPhone应用程序从v1升级到v2的升级测试困住了。我有IPA版本,我正在通过iTunes到我的iPhone设备上的临时分发进行测试,一个用于应用程序的v1,一个用于v2。请注意:Ios &引用;Can';“找不到源存储的模型”;发生在iphone期间;“自动轻量级迁移”;?,ios,iphone,core-data,core-data-migration,Ios,Iphone,Core Data,Core Data Migration,我真的被iPhone应用程序从v1升级到v2的升级测试困住了。我有IPA版本,我正在通过iTunes到我的iPhone设备上的临时分发进行测试,一个用于应用程序的v1,一个用于v2。请注意: v1安装在我的设备上运行良好 如果我删除v1并部署v2(因此没有迁移),那么它可以正常工作 当我在v1已经存在的情况下部署v2时,我得到一个错误:“reason=找不到源存储的模型” 错误的一个片段* reason=**Can't find model for source store**}, {
- v1安装在我的设备上运行良好
- 如果我删除v1并部署v2(因此没有迁移),那么它可以正常工作
- 当我在v1已经存在的情况下部署v2时,我得到一个错误:“reason=找不到源存储的模型”
reason=**Can't find model for source store**}, {
URL = "file://localhost/var/mobile/Applications/AAAAF424-D6ED-40FE-AB8D-66879386739D/Documents/MyApp.sqlite";
metadata = {
NSPersistenceFrameworkVersion = 320;
<cut>
reason=**找不到源存储**的模型{
URL=”file://localhost/var/mobile/Applications/AAAAF424-D6ED-40FE-AB8D-66879386739D/Documents/MyApp.sqlite";
元数据={
NSPersistenceFrameworkVersion=320;
- 当我使用“电话磁盘”查看我的设备时,我看到有Documents/MyApp.sqlite文件
- 将我的v1应用程序部署到AppStore,但没有为我的核心数据模型设置版本(即,在发布版本时并不真正了解,因此没有设置版本)
- v2唯一的额外更改是一个模型上的一个新属性
- 因此,对于v2版本,我所做的是:
- 重新创建新的核心数据模型
- 为模型创建了v1版本
- 为v1创建了对象/属性
- 拯救
- 为模型创建了v2版本
- 创建了一个附加属性
- 拯救
- 重新创建托管对象类
- 更新了调用addPersistentStoreWithType时将选项放入的代码
, reason=Can't find model for source store}, {
URL = "file://localhost/Users/greg/Library/Application%20Support/iPhone%20Simulator/4.3.2/Applications/69FDFDCF-631D-4191-B852-CD75151B1EA9/Documents/MyApp.sqlite";
metadata = {
NSPersistenceFrameworkVersion = 320;
NSStoreModelVersionHashes = {
Config = <5f92f988 71e11a66 554ae924 61887562 22b8de8a c318b110 e3e4a569 81adafa2>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
""
);
NSStoreType = SQLite;
NSStoreUUID = "3B9832DA-E3A1-431B-83E8-43431A7F3452";
};
reason = "Can't find model for source store";
}
,reason=找不到源存储的模型}{
URL=”file://localhost/Users/greg/Library/Application%20Support/iPhone%20Simulator/4.3.2/Applications/69FDFDCF-631D-4191-B852-CD75151B1EA9/Documents/MyApp.sqlite”;
元数据={
NSPersistenceFrameworkVersion=320;
NSStoreModelVersionHashes={
配置=;
};
NSStoreModelVersionHashesVersion=3;
NSStoreModelVersionIdentifiers=(
""
);
NSStoreType=SQLite;
NSStoreUUID=“3B9832DA-E3A1-431B-83E8-43431A7F3452”;
};
reason=“无法找到源存储的模型”;
}
PSS。如果这有助于核心数据模型*.mom的内容,则每个版本存档的目录/包为:
v1
-rw-r--r--1格雷格员工1664年9月5日21:06 MyApp.mom
-rw-r--r--1名格雷格员工2656年9月5日21:06 MyApp.omo
-rw-r--r--1 greg staff 480 5 Sep 21:06 VersionInfo.plist
NSManagedObjectModel_CurrentVersionName
MyApp
NSManagedObjectModel_版本哈希
MyApp
配置
X5l5IHHHGMZVSUKKYH1YIK43ORDGLEQ4+SlaYGtr6I=
v2
-rw-r--r--1 greg staff 497 2 Oct 12:47 MyApp 1.mom
-rw-r--r--1格雷格员工1601 2 10月12日12:47 MyApp 2.mom
-rw-r--r--1格雷格员工1695年10月2日12:47 MyApp.mom
-rw-r--r--1格雷格员工2920 2 10月12日12:47 MyApp.omo
-rw-r--r--1格雷格员工665 2 10月12日12:47 VersionInfo.plist
NSManagedObjectModel_CurrentVersionName
MyApp
NSManagedObjectModel_版本哈希
MyApp
配置
Z/n8092QBHPfBwInZvIm1lei53T1UtZhpNzjl3JA0gs=
MyApp 1
MyApp 2
配置
Fih24clI+kZszFd3X6Gm8itq8YDxudiKnjHW8ydNmps=
编辑:我不清楚的另一个问题是,通过查看下面提供的链接jrturton提出的:
选择xcdatamodeld文件时,您可以在Utilities inspector(右侧窗格)中的Identity and Type选项卡下设置数据模型的版本。其中有一个名为“Core data model”的部分和一个名为“Identifier”的字段 您可以通过选择xcdatamodeld文件来添加新的模型版本,该文件将转到编辑器-->添加模型版本 此时,它会提示您输入要基于它的上一个模型
如果您添加了一个新模型,而没有经过此过程,那么轻量级迁移可能无法工作。如果您对模型进行了更改,并且确保生成了一个模型对象,并且不关心迁移,也不想创建新版本,则只需执行产品->清理,这通常会解决此问题这是个问题 如果您仍然存在此错误,请找到您的sqlite DB并将其删除。当您再次启动应用程序时,它将根据新模型生成一个新的应用程序
或者,您可以从模拟器中删除应用程序,或者,如果所有其他操作都失败,请点击模拟器顶部的“iOS设置”并选择“重置内容和设置…”,它将快速擦除模拟器,以便您可以重新启动。另一个可能导致此问题的原因是:
-rw-r--r-- 1 greg staff 1664 5 Sep 21:06 MyApp.mom
-rw-r--r-- 1 greg staff 2656 5 Sep 21:06 MyApp.omo
-rw-r--r-- 1 greg staff 480 5 Sep 21:06 VersionInfo.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd>">
<plist version="1.0">
<dict>
<key>NSManagedObjectModel_CurrentVersionName</key>
<string>MyApp</string>
<key>NSManagedObjectModel_VersionHashes</key>
<dict>
<key>MyApp</key>
<dict>
<key>Config</key>
<data>
X5L5iHHhGmZVSukkYYh1YiK43orDGLEQ4+SlaYGtr6I=
</data>
</dict></dict></dict>
</plist>
-rw-r--r-- 1 greg staff 497 2 Oct 12:47 MyApp 1.mom
-rw-r--r-- 1 greg staff 1601 2 Oct 12:47 MyApp 2.mom
-rw-r--r-- 1 greg staff 1695 2 Oct 12:47 MyApp.mom
-rw-r--r-- 1 greg staff 2920 2 Oct 12:47 MyApp.omo
-rw-r--r-- 1 greg staff 665 2 Oct 12:47 VersionInfo.plist
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd>">
<plist version="1.0">
<dict>
<key>NSManagedObjectModel_CurrentVersionName</key>
<string>MyApp</string>
<key>NSManagedObjectModel_VersionHashes</key>
<dict>
<key>MyApp</key>
<dict>
<key>Config</key>
<data>
Z/n8092QBHPfBwInZvIm1lei53T1UtZhpNzjl3JA0gs=
</data>
</dict>
<key>MyApp 1</key>
<dict/>
<key>MyApp 2</key>
<dict>
<key>Config</key>
<data>
Fih24clI+kZszFd3X6Gm8itq8YDxudiKnjHW8ydNmps=
</data>
</dict></dict></dict>
</plist>
Simulator > Reset Content and Settings