[英]What are the libraries linking options in Xcode?
As of Xcode 7, there are some library/framework linking options in Xcode从 Xcode 7 开始,Xcode 中有一些库/框架链接选项
Go to application Target
in project tab转到项目选项卡中的应用程序
Target
General -> Embedded Binaries
General -> Link Frameworks and Libraries
Build Phases -> Target Dependencies
Build Phases -> Link Binary with Libraries
Here are a few ways I found这是我找到的几种方法
The Alamofire.framework is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.
Alamofire.framework 在复制文件构建阶段自动添加为目标依赖项、链接框架和嵌入式框架,这是您在模拟器和设备上构建所需的全部。
Creating your first iOS Framework shows that adding the Library.xcodeproj
into workspace, then Build Phases -> Link Binary with Libraries
创建您的第一个 iOS 框架显示将
Library.xcodeproj
添加到工作区,然后Build Phases -> Link Binary with Libraries
Carthage Tutorial: Getting Started shows that dragging Library.framework
into General -> Link Frameworks and Libraries
. Carthage Tutorial: Getting Started显示将
Library.framework
拖入General -> Link Frameworks and Libraries
。 It seems General -> Link Frameworks and Libraries
and Build Phases -> Link Binary with Libraries
are the same似乎
General -> Link Frameworks and Libraries
和Build Phases -> Link Binary with Libraries
是一样的
Carthage seems to differentiate between iOS and OS X. Carthage似乎区分了 iOS 和 OS X。
If you're building for OS X: On your application targets' “General” settings tab, in the “Embedded Binaries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk.
如果您正在为 OS X 构建:在您的应用程序目标的“常规”设置选项卡上,在“嵌入式二进制文件”部分中,从磁盘上的 Carthage/Build 文件夹中拖放您要使用的每个框架。
If you're building for iOS, tvOS, or watchOS: On your application targets' “General” settings tab, in the “Linked Frameworks and Libraries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk.
如果您正在为 iOS、tvOS 或 watchOS 构建:在您的应用程序目标的“常规”设置选项卡上,在“链接的框架和库”部分中,将您要使用的每个框架从 Carthage/Build 文件夹拖放到磁盘。
Reading Linking to a Library or Framework , we know that these options are about linking a framework into our application/framework.阅读Linking to a Library or Framework ,我们知道这些选项是关于将框架链接到我们的应用程序/框架。
But what are the differences between them?但是它们之间有什么区别呢? Is any single option a
catch all
for all of them?是否有任何一个选项可以
catch all
所有这些选项?
For dynamic frameworks built with carthage I usually use this setup:对于使用 carthage 构建的动态框架,我通常使用以下设置:
Only the app target is responsible for embedding all the frameworks and their dependencies.只有应用程序目标负责嵌入所有框架及其依赖项。 That way if an extension and the app both use a framework, it will be distributed with the app only once.
这样,如果一个扩展和应用程序都使用一个框架,它只会与应用程序一起分发一次。
For the Xcode interface:对于 Xcode 界面:
The views under General seem to be filled from the build phases tab so you can use either. General 下的视图似乎是从 build phases 选项卡中填充的,因此您可以使用其中任何一个。
Hope that makes sense.希望这是有道理的。
Edit: Target dependencies are just targets that need to be built before the current target can be built.编辑:目标依赖项只是在构建当前目标之前需要构建的目标。 So your app target would list its extension here, so that the extension gets built, whenever you build your app.
因此,您的应用目标会在此处列出其扩展,以便在您构建应用时构建扩展。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.