我的iOS应用程序已经使用了
CocoaPods几个星期,它与我一直在测试的目标(让我们称之为“MainApp”)完美配合.然而,我现在想要构建一个不同的目标(“MyAppLite”),并注意到构建失败(在其中一个pod的头文件中找不到文件).
我注意到的Build Settings的区别如下:
>其他链接器标志在MyAppLite中不包含所需的框架
> MyAppLite中的框架/标题/库搜索路径都为空
> MainApp中的用户定义的构建设置中没有一个存在于MyAppLite中
如何确保当我运行pod安装时,所有目标都有链接库?
作为参考,这里是我的Podfile:
platform :ios,'5.0' pod 'TTTAttributedLabel','~> 1.7.0' pod 'iRate','~> 1.7.5' pod 'MBProgressHUD','~> 0.6' pod 'FlurrySDK','~> 4.2.3' pod 'ACSimpleKeychain','~> 0.0.1' pod 'WEPopover','~> 0.0.1' pod 'AFNetworking','~> 1.3.1' pod 'Nimbus','~> 1.0.0' pod 'QuincyKit','~> 2.1.9'
解决方法
您可以使用link_with指令
platform :ios,'~> 2.1.9' link_with "MyApp" link_with "MyAppLite"
这将产生libPods.a,它将链接到Target1和Target1.
Note,that cocoapods automatically links every target in the podfile with your project. For this reason the names of the targets should match. If for any reason you want to specify a target in your podfile with a different name,you can set the
link_with
attribute:06001
Targets,by default,are exclusive if their parent has a different platform.
The main target of the Podfile,is always linked with the first target of the final Project.