CocoaPods link_with

Iva*_*vic 1 cocoapods

我想为不同的目标包含不同的库.

link_with 'Target 1', 'Target 2', 'Target 3'
platform :ios, '7.0'
pod 'MMWormhole', '~> 1.1.1'

link_with 'Target 4', 'Target 5'
platform :ios, '7.0'
pod 'AFNetworking', '~> 2.5'
pod 'MBProgressHUD', '~> 0.8'
pod 'MMWormhole', '~> 1.1.1'
Run Code Online (Sandbox Code Playgroud)

怎么做?

解决方案 (感谢SalvoC的解决方案!)

target :'Main App', :exclusive => true do
  platform :ios, '7.0'
  pod 'AFNetworking', '~> 2.5'
  pod 'MBProgressHUD', '~> 0.8'
  pod 'MMWormhole', '~> 1.1.1'

  platform :ios, '8.0'
  pod 'SplunkMint'
end

target :'Main App Extension', :exclusive => true do
  platform :ios, '7.0'
  pod 'MMWormhole', '~> 1.1.1'
end
Run Code Online (Sandbox Code Playgroud)

在Podfile中更改目标配置时,请确保删除了以前生成的所有*.a文件.它们会持续存在于每个目标中,并且在构建时会出现关于"重复"的错误.

如果您在运行pod install之前手动更改了"Other Linker Flages",请确保删除旧条目并输入$(继承).

干杯

Sal*_*voC 5

在这种情况下,您不应该使用link_with.试试这个:

target :'Target 1', :exclusive => true do
   platform :ios, '7.0'
   pod 'MMWormhole', '~> 1.1.1'
end
Run Code Online (Sandbox Code Playgroud)

并为每个目标指定语句