ios - Xcode - Cocoapods 如何编译 pod?

标签 ios xcode cocoapods

我有一个用 cocoapods 构建的 xcworkspace(pod 安装)。我无法弄清楚 xCode 是如何知道在我构建 MyProject 时它还必须构建 Pods 项目的事情?

假设:

在构建阶段“将二进制文件与库链接”部分的 MyProject 主要目标中,我可以看到“Pods_MyProject.framework”,它指的是由 Pods(项目)Pods-MyProject 目标构建的 .framework(是否正确?)。这个目标在他的“目标依赖项”中有所有的 pod 。

但是有两点我还是不明白

  1. Xcode 如何知道当我构建 MyProject 时它必须首先构建 Pods-MyProject ? (MyProject 主要目标“目标依赖项”部分没有任何内容)

这是“MyProject”(它的真实名称是“clicktube”)的构建阶段选项卡:

enter image description here

  1. “Pods_MyProject.framework”如何包含所有 Pod 而其“Link Binary with Libraries”部分几乎是空的?

Pods-MyProject“与库链接”部分:

enter image description here

最佳答案

有趣的是:

https://developer.apple.com/library/content/featuredarticles/XcodeConcepts/Concept-Workspace.html#//apple_ref/doc/uid/TP40009328-CH7-SW1

Xcode examines the files in the build directory to discover implicit dependencies. For example, if one project included in a workspace builds a library that is linked against by another project in the same workspace, Xcode automatically builds the library before building the other project, even if the build configuration does not make this dependency explicit. You can override such implicit dependencies with explicit build settings if necessary. For explicit dependencies, you must create project references.

依赖有两种类型:显式和隐式。您在“目标依赖项”中指定显式的。 XCode 通过查看“Link binary with libraries”发现隐式依赖关系,然后决定构建项目的顺序。

How the "Pods_MyProject.framework" contains all the pods while its "Link Binary with Libraries" section is almost empty ?

如果您查看 Pods.xcodeproj,您通过 podfile“安装”的每个框架都有一个目标。然后是 Pods_MyProject.framework 目标,它明确依赖于所有这些框架。

关于ios - Xcode - Cocoapods 如何编译 pod?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40388769/

相关文章:

ios - 来自 GitHub 的项目的 Apple Mach-O 链接器错误

ios - Apple Mach-O 链接器错误 - Xcode (Swift)

iphone - UILineBreakMode 与 NSLineBreakMode

ios - facebook sdk for ios feed 对话框问题,虽然发布了帖子但不显示帖子

ios - AdMob 刷新请求

objective-c - NSLayoutConstraint.constraintsWithVisualFormat 右下对齐

xcode - (Xcode) 启用 iCloud 时权限被拒绝

iphone - 在 App Store 中发布应用程序更新

xcode - Interface Builder 在 Xcode 6.3 的视网膜显示屏上显得模糊

ios - CocoaPods 和更新的 (iOS 8) API?