无法在XCode中将嵌入式二进制文件(其他项目)添加到项目依赖项中 [英] Cannot add embedded binaries (other projects) to project dependencies in XCode

查看:160
本文介绍了无法在XCode中将嵌入式二进制文件(其他项目)添加到项目依赖项中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用XCode 6.0.1创建的XCode工作区。它拥有2个(Swift)库和一个依赖于这2个库的iOS应用程序(Swift)。我有稳定的设置,允许我在iPhone和模拟器上运行iOS应用程序:2个库项目被添加为应用程序的嵌入式二进制文件(见图片)。

I have an XCode workspace created with XCode 6.0.1. It constains 2 (Swift) libraries and one iOS app (Swift) that depends on those 2 libraries. I had stable setup that allowed me to run the iOS app on both iPhone and simulators: The 2 library projects were added as Embedded Binaries (see picture) of the app.

现在,我有XCode 6.1。最近,我在XCode运行时删除了〜/ Library / Developer / Xcode 文件夹中的 DerivedData 文件夹。之后我的工作区不起作用 - iOS应用程序无法编译,我收到链接器错误,说它无法找到库项目。

Now, I have XCode 6.1. Recently, I deleted DerivedData folder in ~/Library/Developer/Xcode folder while XCode was running. After that my workspace did not work - the iOS app would fail to compile and I got linker error saying it cannot find the library projects.

我试图通过删除来解决它我的应用程序项目的嵌入式二进制文件中的2个库 - 我无法添加它们。在项目设置中单击嵌入式二进制文件下的+按钮可正确显示工作区项目,但选择和添加我的库项目不会将它们添加到嵌入式二进制文件列表中。我通过创建新工作区解决了链接器错误。该应用程序编译,但它如何链接库对我来说是一个谜:它们不在列出嵌入式二进制文件链接框架和库不在框架搜索路径中。应用程序和它需要的库之间似乎没有任何联系(显然有编译时),除了库项目在同一个工作区。

I tried to solve it by removing my the 2 libraries from Embedded Binaries of the app project - and I cannot add them back. Clicking + button under Embedded Binaries in project settings displays workspace projects correctly but selecting and adding my library project does not add them to the list of Embedded Binaries. I have solved the linker error by creating new workspace. The app compiles but how it links the libraries is a mystery to me: They are not in listed Embedded Binaries or Linked Frameworks and Libraries not in the Frameworks search path. There appears to be no link between the app and the libraries it needs (and obviously have as it compiles) except that libraries projects are in the same workspace.

为什么我不能将库项目添加到嵌入式二进制文件?在XCode 6.1中,依赖项目是否正常编译并嵌入到应用程序中而不在任何地方列出或链接是否正常?

Why I cannot add library projects to Embedded Binaries? Is it normal in XCode 6.1 that dependency projects just compile and gets embedded into an app without being listed or linked anywhere?

推荐答案

这是我的摘要回答问题删除DerivedData后,Xcode不会添加嵌入式二进制文件查看原始问题并回答更多上下文和信息

This is a summary of my answer to the question Xcode won't add "Embedded binary" after deleting "DerivedData", see the original question and answer for more context and information:


  1. 从工作区中删除所有框架项目

  2. 执行clean build和/或删除DerivedData

  3. 将项目添加回工作区

  4. 构建项目(可能是可选的)

  5. 在应用目标的常规选项卡中,单击链接的框架和库下的+ ,选择框架。

  6. 构建并运行在模拟器中(应该没有问题构建或运行)

  7. 构建并运行设备(这可能会导致崩溃,因为框架没有正确链接,忽略此崩溃)

  8. 点击嵌入式二进制文件下的+,选择框架。这应该将它添加到项目中(在链接的框架和库下可能重复)

  9. 重复所有必需的框架

  10. 构建和运行后(在设备上)确认您可以删除Project Navigator中的任何重复(和/或红色)框架或目标常规选项卡

  1. Remove all framework projects from the workspace
  2. Perform a "clean build" and/or remove the "DerivedData"
  3. Add project back into the workspace
  4. Build the project (possibly optional)
  5. In the General tab of the app target click the + under "Linked Frameworks and Libraries", select the framework.
  6. Build and run in the Simulator (there should be no issues building or running)
  7. Build and run for device (this might cause a crash due to the framework not being correctly linked, ignore this crash)
  8. Click the + under "Embedded Binaries", select the framework. This should add it to the project (possible duplicate under "Linked Frameworks and Libraries")
  9. Repeat for all required frameworks
  10. Once building and running (on device) is confirmed you can remove any duplicate (and/or red) frameworks in the Project Navigator or target General tab

这篇关于无法在XCode中将嵌入式二进制文件(其他项目)添加到项目依赖项中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆