简体   繁体   English

框架目标,App目标和cocoaPods一起工作,如何维护依赖项

[英]Framework target, App target and cocoaPods working together, how to maintain dependencies

I am creating a framework that uses third party frameworks like alamofire. 我正在创建一个使用第三方框架(如alamofire)的框架。 I have created a App that uses this framework and also uses third party framework again like alamofire(both could use it). 我创建了一个使用此框架的应用程序,并且还像alamofire一样再次使用第三方框架(两者都可以使用它)。 So now I have 2 targets, I added both in workspace, I did pod init but it could only link with only one .xcodeproj and create its own workspace. 所以现在我有2个目标,我在工作区中添加了两个,我做了pod init但它只能与一个.xcodeproj链接并创建自己的工作区。

I also tried 我也试过了

Can I use CocoaPods when creating a Cocoa Touch Framework? 我可以在创建Cocoa Touch Framework时使用CocoaPod吗?

but pod install didn't work as it was not able to find target and if dragged in same folder it ask to specify target path as it only want one .xcodeproj 但是pod安装不起作用,因为它无法找到目标,如果在同一个文件夹中拖动它要求指定目标路径,因为它只需要一个.xcodeproj

Please if somebody could help me with this. 如果有人可以帮我这个。 How to access cocoa pods framework in both custom framework and app. 如何在自定义框架和应用程序中访问cocoa pods框架。

Ideally the Pod should be in your App. 理想情况下,Pod应该在您的应用程序中。

Even though your Framework is also using the same third party framework the pod install should be done for that at App level and both App and framework should be able to read it. 即使您的框架也使用相同的第三方框架,也应该在App级别完成pod安装,并且App和框架都应该能够读取它。 Have said that, if you are developing Framework independently you can install POD at that time in framework but when your are using this framework in app then the third party framework can be installed at app level and frameworks should also be able to read it since they are now also part of same App target. 如果您正在独立开发Framework,那么您可以在框架中安装POD,但是当您在应用程序中使用此框架时,第三方框架可以安装在应用程序级别,框架也应该能够读取它,因为它们现在也是同一App目标的一部分。

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

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