xcode 更新到 1.0.0 后 cocoapods link_with 出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37280077/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 08:49:01  来源:igfitidea点击:

Error with cocoapods link_with after update to 1.0.0

iosxcodecocoapods

提问by croigsalvador

I have updated cocoapods today to 1.0.0 version. I got this string when I update the pods:

我今天已将 cocoapods 更新到 1.0.0 版本。当我更新 Pod 时,我得到了这个字符串:

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

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

I have removed link_with in my podFile but I can't build the project because I have many Match-O-Linkers. Any one knows how should I fix this problem?

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

This is my Podfile right now:

这是我现在的 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

回答by Geeroz

Try this. Works for me with more than one target.

尝试这个。有多个目标对我有用。

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

回答by Jakub Truhlá?

According to the new official CocoaPods specificationsince version 1.0 the new model is this:

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

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

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

TargetNameOneand TargetNameTwoare the real names.

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

Edit- There is an implicit abstract target at the root of the Podfilenow, so you could write the above example as:

编辑-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'
  • This is for multiple targets which is the most common case, but can be used for single target as well and I like one universal pattern.
  • 这是针对多个目标,这是最常见的情况,但也可用于单个目标,我喜欢一种通用模式。

回答by Shubhank

With the new specification. all your pod include should be specified target based. Change your pod file to

随着新规范。你所有的 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