“无法找到源存储的模型”发生在iphone“自动轻量级迁移”? [英] "Can't find model for source store" occurring during iphone "Automatic Lightweight Migration"?
问题描述
我真的卡在这里与升级测试从v1到v2的iPhone应用程序。我有IPA版本,我正在通过iTunes通过我的iPhone设备,一个为v1的应用程序和一个v2的ad hoc分发测试。请注意:
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和部署v2,则
- (因此没有迁移),那么它工作正常
- 当我部署v2,而v1已经在那里我得到的错误:原因=无法找到源存储模型
错误代码段... *
A snippet from the error...*
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版本,我所做的是:
- 重建了新的Core Data模型
- 为模型创建了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文件中,因此您需要在每个文件中放置什么?
推荐答案
当选择xcdatamodeld文件时,在实用程序检查器(右侧窗格)的标识和类型选项卡下设置数据模型的版本。这有一个名为核心数据模型的部分和一个名为标识符的字段。
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屋!