Xcode 如何在另一个项目中添加静态库项目?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4358181/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:58:20  来源:igfitidea点击:

Xcode how to add a static library project in another project?

iphoneobjective-cxcode

提问by g.revolution

i have an 2 XCode iphone projects. 1 creates a static library. i want to use that static library in my other project.

我有 2 个 XCode iphone 项目。1 创建一个静态库。我想在我的另一个项目中使用那个静态库。

how to attach that static library project with my other project. so that when i compile my other project it will automatically compile the static library project and use that library.

如何将该静态库项目附加到我的其他项目中。这样当我编译我的另一个项目时,它会自动编译静态库项目并使用该库。

how to do this ?

这该怎么做 ?

回答by vdaubry

It's quite simple :

这很简单:

First you need to drag the static library project file (xcodeproj) into your project to make a cross-project reference.

首先需要将静态库项目文件(xcodeproj)拖入你的项目中,进行跨项目引用。

Then you need to add the static library target as a dependency of your application app : go into the "Link Binary With Libraries" build phase of your application target and drag the static library target into it.

然后,您需要将静态库目标添加为应用程序的依赖项:进入应用程序目标的“Link Binary With Libraries”构建阶段,并将静态库目标拖入其中。

You can find an example of this process with the GData API : http://code.google.com/p/gdata-objectivec-client/wiki/BuildingTheLibrary

您可以使用 GData API 找到此过程的示例:http: //code.google.com/p/gdata-objectivec-client/wiki/BuildingTheLibrary

(under the "Linking to the iPhone Static Library" section)

(在“链接到 iPhone 静态库”部分下)

Hope this helps, Vincent.

希望这会有所帮助,文森特。