错误与cocoapods link_with更新到1.0.0后

我今天更新了cocoapods到1.0.0版本。 当我更新豆荚时,我得到了这个string:

[!] Invalid Podfile file: [!] The specification of link_with in the Podfile is now unsupported, please use target blocks instead..

我已经删除了我的podFile中的link_with,但我无法构build项目,因为我有许多Match-O-Linkers。 任何人都知道我应该如何解决这个问题?

这是我的Podfile现在:

 source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' inhibit_all_warnings! pod 'pop', '~> 1.0' pod 'AFNetworking', '~> 1.3' pod 'SDWebImage', '~> 3.7' pod 'GoogleAnalytics', '~> 3' pod 'ARAnalytics' , :subspecs => ["Crashlytics", "Amplitude", "DSL"] pod 'FBSDKCoreKit', '~> 4.10.1' pod 'FBSDKLoginKit', '~> 4.10.1' pod 'FBSDKShareKit', '~> 4.10.1' pod 'Google/SignIn' pod 'Branch' pod 'Leanplum-iOS-SDK' pod 'Fabric', '1.6.7' pod 'Crashlytics', '3.7.0' pod 'TwitterKit' pod 'Digits' target 'minubeTests' do pod 'OCMockito' end 

尝试这个。 适用于多个目标的我。

 source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' def myPods pod 'pop', '~> 1.0' pod 'AFNetworking', '~> 1.3' pod 'SDWebImage', '~> 3.7' pod 'GoogleAnalytics', '~> 3' pod 'ARAnalytics' , :subspecs => ["Crashlytics", "Amplitude", "DSL"] pod 'FBSDKCoreKit', '~> 4.10.1' pod 'FBSDKLoginKit', '~> 4.10.1' pod 'FBSDKShareKit', '~> 4.10.1' pod 'Google/SignIn' pod 'Branch' pod 'Leanplum-iOS-SDK' pod 'Fabric', '1.6.7' pod 'Crashlytics', '3.7.0' pod 'TwitterKit' pod 'Digits' end target 'yourTargetOne' do myPods end target 'yourTargetTwo' do myPods end target 'minubeTests' do pod 'OCMockito' end 

根据自1.0版以来的新官方CocoaPods 规范 ,新模型是这样的:

请注意, BasePods不是项目中任何目标的实际名称。

TargetNameOneTargetNameTwo是真实姓名。

 platform :ios, '8.1' inhibit_all_warnings! abstract_target 'BasePods' do ## Networking pod 'AFNetworking', '~> 2.6' # Twitter pod 'TwitterKit', '~> 1.9' pod 'Fabric' # Specify your actual targets target 'TargetNameOne' target 'TargetNameTwo' end 

编辑 – 现在在Podfile的根目录下有一个隐式的抽象目标,所以你可以把上面的例子写成:

 platform :ios, '8.1' inhibit_all_warnings! ## Networking pod 'AFNetworking', '~> 2.6' # Twitter pod 'TwitterKit', '~> 1.9' pod 'Fabric' # Specify your actual targets target 'TargetNameOne' target 'TargetNameTwo' 
  • 这是针对多个目标,这是最常见的情况,但也可以用于单个目标,我喜欢一个通用模式。

随着新的规范 。 所有的pod包括应该指定目标为基础。 将您的pod文件更改为

 platform :ios, '8.0' # change minube to whatever name is of you main target target 'minube' do pod 'pop', '~> 1.0' pod 'AFNetworking', '~> 1.3' pod 'SDWebImage', '~> 3.7' pod 'GoogleAnalytics', '~> 3' pod 'ARAnalytics' , :subspecs => ["Crashlytics", "Amplitude", "DSL"] pod 'FBSDKCoreKit', '~> 4.10.1' pod 'FBSDKLoginKit', '~> 4.10.1' pod 'FBSDKShareKit', '~> 4.10.1' pod 'Google/SignIn' pod 'Branch' pod 'Leanplum-iOS-SDK' pod 'Fabric', '1.6.7' pod 'Crashlytics', '3.7.0' pod 'TwitterKit' pod 'Digits' end target 'minubeTests' do pod 'OCMockito' end