关于ios:更新到1.0.0后,cocoapods link_with错误

 2021-04-09 

Error with cocoapods link_with after update to 1.0.0

我今天将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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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


尝试一下。对我来说有多个目标。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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规范,新模型为:

Note that BasePods is not the actual name of any target in the project.

TargetNameOneTargetNameTwo是真实名称。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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的根现在有一个隐式抽象目标,因此您可以将上面的示例写为:

1
2
3
4
5
6
7
8
9
10
11
12
13
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文件更改为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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