简体   繁体   English

如何在Xcode 4中将现有.momd添加到项目中?

[英]How to add existing .momd to a project in Xcode 4?

I have a project that includes a subproject. 我有一个包含子项目的项目。 The subproject has a Core Data model and generates a .momd "bundle." 该子项目具有Core Data模型,并生成一个.momd“捆绑包”。 I need that .momd bundle to be included in the main projects app bundle that is generated when the project is built. 我需要将.momd包包含在构建项目时生成的主要项目应用包中。 The .momd file is generated, and is in the build directory, but I cannot see how to get it included in the final app bundle. .momd文件已生成,并且位于构建目录中,但是我看不到如何将其包含在最终的应用程序包中。

I can add the .momd as a file in the "Copy Bundle Resources" (by adding a reference to it to the main project in my Supporting Files group) but since the .momd is not a Finder level bundle, it adds it in as a directory and the .momd contents get copied into the app bundle, but not the .momd folder itself, so the system cannot find it when the app runs. 我可以将.momd添加为“复制捆绑包资源”中的文件(通过在“支持文件”组中添加对主项目的引用),但是由于.momd不是Finder级别的捆绑包,因此将其添加为目录和.momd内容被复制到应用程序捆绑包中,而不是复制到.momd文件夹本身,因此在应用程序运行时系统找不到该目录。

Of course, after trying all sorts of things all afternoon, and searching with Google and Bing and inside SO, and not coming up with anything, soon after I post the question, I figure it out. 当然,在整个下午尝试了各种方法,并在Google和Bing以及SO内部进行搜索之后,并没有提出任何建议,在我发布问题后不久,我便找到了答案。

When adding the .momd file to the main app project (I added it to "Supporting Files" group), check "Create folder references for any added folders" and NOT "create groups for any added folders" (And also do not check "Copy items into destination group's folder" if the .momd is being generated in a sub-project) 将.momd文件添加到主应用程序项目(我将其添加到“支持文件”组中)时,选中“为任何添加的文件夹创建文件夹引用”,而不是“为任何添加的文件夹创建组”(也不要选中“如果在子项目中生成了.momd,则将项目复制到目标组的文件夹中”)

Doing it that way makes the .momd gets copied into the app bundle... 这样做会使.momd复制到应用程序包中...

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

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