“找不到源商店的模型"iphone“自动轻量级迁移"期间发生的问题? [英] "Can't find model for source store" occurring during iphone "Automatic Lightweight Migration"?
问题描述
我真的被一个 iPhone 应用程序从 v1 升级到 v2 的测试困住了.我有 IPA 版本,我正在通过 iTunes 临时分发到我的 iPhone 设备进行测试,一个用于应用程序的 v1,一个用于 v2.请注意:
I'm really stuck here with upgrade testing from v1 to v2 of an iPhone application. I have IPA releases that I'm testing via ad hoc distribution via iTunes to my iPhone device, one for v1 of the app and one for v2. Note that:
- v1 安装在我的设备上运行良好
- 如果我删除 v1 并部署 v2(所以没有迁移)那么它工作正常
- 当我部署 v2 而 v1 已经存在时,我收到错误消息:原因=无法找到源存储模型"
错误的片段...*
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>
- 当我使用手机磁盘"查看我的设备时,我看到有 Documents/MyApp.sqlite 文件
- 在没有为我的核心数据模型设置版本的情况下将我的 v1 应用部署到 AppStore(即在版本时并没有真正意识到,所以没有设置)
- v2 的唯一额外变化是一个模型上的一个新属性
- 对于 v2 版本,我所做的是:
- 重新创建了一个新的核心数据模型
- 为模型创建了一个 v1 版本
- 为 v1 创建对象/属性
- 已保存
- 为模型创建了 v2 版本
- 创建了一个附加属性
- 已保存
- 重新创建托管对象类
- 更新了代码以将选项放入每个 http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/vmLightweight.html#//apple_ref/doc/uid/TP40008426-SW1 调用 addPersistentStoreWithType 时
- Deployed my v1 app to the AppStore without setting up a version for my core data model (i.e. wasn't really aware at the time of versions, so didn't set one up)
- The only additional change for v2 was one new attribute on the one model
- So for the v2 release what I've done is:
- Recreated a new Core Data Model
- Created a v1 version for the model
- Created the object/attributes for v1
- Saved
- Created a v2 version for the model
- Created the one additional attribute
- Saved
- Recreated the managed object classes
- Updated the code to put the options in per http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/vmLightweight.html#//apple_ref/doc/uid/TP40008426-SW1 when calling addPersistentStoreWithType
问题 - 知道如何解决这个问题吗?我可以在这里做哪些调试/分析?如果您需要更多信息,请告诉我.
Question - Any ideas how to resolve this? What debugging/analysis could I do here? Let me know if you need any more info.
我所做的概述是:
PS 完整版的错误(如果有帮助) - 这次来自在模拟器上模拟迁移错误
, 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";
}
PSS.如果这有助于每个版本归档的核心数据模型 *.mom 目录/包的内容是:
v1
-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>
v2
-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>
通过查看下面提供的 jrturton 链接提出的另一个我不清楚的问题是:
Another question that is not clear to me, as raised by reviewing the link jrturton provided below is:
- 现在最新的 XCode 版本如何将设置当前版本"设置为适当的模型版本文件?即之前的帖子强调了两个不同的步骤,一个是添加模型版本,另一个是设置当前版本"
- 应该如何使用可以为每个核心数据模型文件设置的核心数据模型标识符"字段.它在检查员中.该参数存在于例如 MyApp 1.xcdatamodel、MyApp 2.xcdatamodel 和 MyApp.xcdatamodel 文件中,那么您需要在每个文件中输入什么?
推荐答案
You set the version of your data model in the Utilities inspector (right hand pane), under the Identity and Type tab when the xcdatamodeld file is selected.这有一个名为核心数据模型"的部分,以及一个名为标识符"的字段.
You set the version of your data model in the Utilities inspector (right hand pane), under the Identity and Type tab when the xcdatamodeld file is selected. This has a section called "Core Data Model", and a field called "Identifier".
您通过选择 xcdatamodeld 文件添加新模型版本,然后转到编辑器 --> 添加模型版本.
You add a new model version by selecting the xcdatamodeld file, the going to Editor --> Add model version.
此时它会提示您输入以前的模型作为它的基础.
At this point it prompts you for the previous model to base it on.
如果您在未经过此过程的情况下添加了新模型,则轻量级迁移可能不起作用.
If youve added a new model without going through this process the lightweight migration may not work.
这篇关于“找不到源商店的模型"iphone“自动轻量级迁移"期间发生的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!