简体   繁体   English

如何在最终应用程序中包含所有内容

[英]How to include everything on the final app

I have a project that is using 2 static libraries I have created, lets call them libraryA and libraryB and a Bundle. 我有一个项目正在使用我创建的2个静态库,我们称它们为libraryA和libraryB以及一个捆绑包。

The main project uses libraryA, libraryB and the bundle and libraryA also have calls to libraryB and the bundle. 主项目使用libraryA,libraryB和捆绑软件,并且libraryA也调用了libraryB和捆绑软件。

Every static library, the bundle and the main project were created by initiating a new project in Xcode. 每个静态库,包和主项目都是通过在Xcode中启动一个新项目来创建的。 The last project to be created was MyProject.xcodeproj. 最后一个要创建的项目是MyProject.xcodeproj。 After creating that project I dragged libraryA.xcodeproj, libraryB.xcodeproj and myBundle.xcodeproj to it and ended with something like this: 创建该项目后,我将libraryA.xcodeproj,libraryB.xcodeproj和myBundle.xcodeproj拖到该项目上,并以如下所示结束:

在此处输入图片说明

Everything is compiling and running beautifully but inspecting inside MyProject.app, I see it did not contain the resource files that are inside myBundle. 一切都在正常编译和运行,但是在MyProject.app内部进行检查时,我发现它不包含myBundle内部的资源文件。 Yes, myBundle.bundle is on "copy bundle resources" phase of MyProject and also on the target dependencies. 是的,myBundle.bundle在MyProject的“复制捆绑包资源”阶段,也在目标依赖项上。

BTW, please explain me how should I set the "target dependencies", "link binary with libraries" and "copy bundle resources" sections of build phases for all parts of this project, so the final app will include everything. 顺便说一句,请向我解释我应该如何为该项目的所有部分设置构建阶段的“目标依赖项”,“与库链接的二进制文件”和“复制捆绑包资源”部分,因此最终的应用程序将包括所有内容。

thanks. 谢谢。

Target Dependencies just means which other targets will be executed first before your current target builds. 目标依赖关系仅表示在构建当前目标之前首先执行哪些其他目标。 If you want to pick up changes to library's and bundles before compiling the main project, then make sure each of those targets are included. 如果要在编译主项目之前对库和捆绑软件进行更改,请确保包括了每个目标。 The project will still build fine if you remove them from dependencies, you just will have to manually build the libraries' projects when you want to add changes. 如果将它们从依赖项中删除,则该项目仍然可以正常运行,只需要在要添加更改时手动构建库的项目即可。

Link with binary libraries should show both libraryA and B. It will reference the latest built version of that library, so combined with the target dependencies, your MyProject app will have all of the latest changes to your libraries. 与二进制库的链接应同时显示libraryA和B。它将引用该库的最新构建版本,因此结合目标依赖项,您的MyProject应用将对您的库进行所有最新更改。

If your MyProject app is running fine, chances are you did everything correctly. 如果您的MyProject应用运行良好,则可能是您正确完成了所有操作。 If you can reference classes in the static libraries without getting linker errors, then those are being linked correctly. 如果您可以引用静态库中的类而不会出现链接器错误,则说明这些链接已正确链接。 If the resources from myBundle are showing up in the app's UI, then that is being copied over properly as well. 如果来自myBundle的资源显示在应用程序的UI中,则该资源也将被正确复制。

If you're missing files from the bundle, look in your MyBundle project and make sure that its Copy Bundle Resources section shows the files you want included. 如果丢失了捆绑包中的文件,请查看MyBundle项目,并确保其“复制捆绑包资源”部分显示要包含的文件。

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

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