更新到1.0.0后cocoapods link_with出错

cro*_*dor 30 xcode ios cocoapods

我今天更新了cocoapods到1.0.0版本.我更新pod时得到了这个字符串:

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

我已经删除了podFile中的link_with,但我无法构建项目,因为我有很多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
Run Code Online (Sandbox Code Playgroud)

小智 42

试试这个.适用于多个目标的我.

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
Run Code Online (Sandbox Code Playgroud)

  • 根据2016年6月13日在旧金山举行的CocoaPods核心团队演示,不推荐使用`def ... end`的解决方案.推荐的解决方案是`abstract_target ... do ... end`. (2认同)

Jak*_*lář 30

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

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

TargetNameOne而且TargetNameTwo是真名.

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
Run Code Online (Sandbox Code Playgroud)

编辑 - 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'
Run Code Online (Sandbox Code Playgroud)
  • 这是针对多个目标,这是最常见的情况,但也可以用于单个目标,我喜欢一个通用模式.