简体   繁体   English

如何在 xcode 中添加库项目?

[英]How to add a library project in xcode?

How do I add a third party library project to my Xcode project so that the third party Library header files are accessible to the rest of the file in the main project.如何将第三方库项目添加到我的 Xcode 项目中,以便主项目中的其余文件可以访问第三方库头文件。

I tried drag and drop;我试过拖放; Added target Dependencies;添加了目标依赖项; and did 'Link binary with libraries', but still I am not able to include the third party header files.并做了“用库链接二进制文件”,但我仍然无法包含第三方头文件。 Am I missing out something?我错过了什么吗?

Make sure your project can find the headers of your third party library.确保您的项目可以找到第三方库的标头。 Check the "Header Search Path", "Library Search Path", and "User Header Search Paths" entries in "Build Settings".检查“Build Settings”中的“Header Search Path”、“Library Search Path”和“User Header Search Paths”条目。 Also, set the "Always Search User Paths" key to "Yes".此外,将“始终搜索用户路径”键设置为“是”。

Hope this helps!希望这可以帮助!

first you drag the library to the project directory.首先将库拖到项目目录中。 and remember to click copy to the project repo when xcode ask.并记得在 xcode 询问时单击复制到项目存储库。

then you have to add librarys header filer at appDelegate.h.然后你必须在 appDelegate.h 添加库头文件。 alloc and init the necessary instance...分配并初始化必要的实例...

for all the other viewcontrollers which want to use this library just add #import appDelegate.h and init appdelegate instance, in order to use the library.对于想要使用该库的所有其他视图控制器,只需添加 #import appDelegate.h 和 init appdelegate 实例,即可使用该库。

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

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