Error with cocoapods link_with after update to 1.0.0

£可爱£侵袭症+ 提交于 2019-11-27 15:34:22

问题


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

[!] 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?

This is my Podfile right now:

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:


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



回答2:


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

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

TargetNameOne and TargetNameTwo are the real names.

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 Podfile now, so you could write the above example as:

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.



回答3:


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

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


来源:https://stackoverflow.com/questions/37280077/error-with-cocoapods-link-with-after-update-to-1-0-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!