简体   繁体   English

Xcode不将资源复制到octests捆绑软件

[英]Xcode not copying resource to octests bundle

WTF? WTF? Xcode 4.6.2 is refusing to copy one of my resource files to the octest bundle. Xcode 4.6.2拒绝将我的资源文件之一复制到octest捆绑软件。

These line, from the build log, work : 这些行在构建日志中有效

CpResource AppName/Resources/Domain.sqlite /Users/colin/Library/Developer/Xcode/DerivedData/AppName-WS-dbpjomrlampddifnmkfrqcashprt/Build/Products/Debug-iphonesimulator/AppName.app/Domain.sqlite
cd "/Users/colin/Documents/work/daring plan/AppName"
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks "/Users/colin/Documents/work/daring plan/AppName/AppName/Resources/Domain.sqlite" /Users/colin/Library/Developer/Xcode/DerivedData/AppName-WS-dbpjomrlampddifnmkfrqcawhprt/Build/Products/Debug-iphonesimulator/AppName.app

But these lines, from later in the same build log , silently result in nothing being copied: 但是,这些行(稍后在同一构建日志中)将无提示地导致未复制任何内容:

CpResource AppName/Resources/Domain.sqlite /Users/colin/Library/Developer/Xcode/DerivedData/AppName-WS-dbpjomrlampddifnmkfrqcashprt/Build/Products/Debug-iphonesimulator/AppNameLogicTests.octest/Domain.sqlite
cd "/Users/colin/Documents/work/daring plan/AppName"
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks "/Users/colin/Documents/work/daring plan/AppName/AppName/Resources/Domain.sqlite" /Users/colin/Library/Developer/Xcode/DerivedData/AppName-WS-dbpjomrlampddifnmkfrqcawhprt/Build/Products/Debug-iphonesimulator/AppNameLogicTests.octest

These are both generated by what look to me to be identical Copy Bundle Resources configurations in the App and LogicTests targets. 在我看来,这两者都是由App和LogicTests目标中相同的副本捆绑资源配置生成的。 I've tried deleting and recreating the line for Domain.sqlite in the LogicTests target, but didn't help. 我尝试删除并在LogicTests目标中重新创建Domain.sqlite的行,但没有帮助。

I have tried deleting both the app and octest bundles from Build/Products/Debug-iphonesimulator, and Xcode goes ahead and recreates them, but with Domain.sqlite missing from the octest bundle. 我尝试从Build / Products / Debug-iphonesimulator中删除app和octest捆绑包,并且Xcode继续并重新创建它们,但是octest捆绑包中缺少Domain.sqlite。 WTF. WTF。

Okay, tracked it down. 好吧,找到它了。 Xcode was copying the file just fine, but it was out of sync with my data model (I thought I'd rebuilt it, but been deceived). Xcode可以很好地复制文件,但是它与我的数据模型不同步(我以为我会重建它,但是被欺骗了)。 And I am using a 3rd-party library called MagicalRecord to manage the core data stack, and apparently in a recent version it added a property called shouldDeleteStoreOnModelMismatch. 我正在使用一个名为MagicalRecord的第三方库来管理核心数据堆栈,显然在最新版本中,它添加了一个名为shouldDeleteStoreOnModelMismatch的属性。 When I look back farther in my build log, there it is: 当我在构建日志中往回看时,它是:

-[NSPersistentStoreCoordinator(MagicalRecord) MR_addSqliteStoreNamed:withOptions:](0x17e24f0) Removed incompatible model version: Domain.sqlite

Moral of the story: when you're distributing a pre-built sqlite file with your app, you want 故事的寓意:在通过应用分发预建的sqlite文件时,您需要

[MagicalRecord setShouldDeleteStoreOnModelMismatch:false];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM