简体   繁体   English

在辅助Xcode项目中使用CocoaPods

[英]Use CocoaPods in a secondary Xcode project

I have an Xcode workspace that has two projects. 我有一个Xcode工作区,有两个项目。 The main project uses the second project as a static library. 主项目使用第二个项目作为静态库。 The main project is working fine with CocoaPods. 主要项目与CocoaPods一起正常运行。 In both projects I need to include AFNetworking. 在这两个项目中,我需要包括AFNetworking。 How can I set this up correctly? 如何正确设置?

PS: I am using unit test in the static library project so including AFNetworking headers wont be enough. PS:我在静态库项目中使用单元测试,因此包括AFNetworking标头不够。

Since you are already using cocoapods, I thinks the best way is to become your secondary project a pod itself, a private one if you can not free the code. 由于您已经在使用cocoapods,我认为最好的方法是成为您的辅助项目本身,如果您无法释放代码,则为私有项目。 That way you can define in the podspec all the dependencies you need, like AFNetworking and when you use that in the main project all the dependencies will be managed for you. 这样您就可以在podspec中定义所需的所有依赖项,例如AFNetworking,当您在主项目中使用它时,将为您管理所有依赖项。

Also that way unit testing and reusing should become even easier. 此外,单元测试和重用应该变得更加容易。

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

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