Pod install displaying error in cocoapods version 1.0.0.beta.1

后端 未结 12 1024
傲寒
傲寒 2020-12-07 10:03

My podfile was working but after updating to cocoapods version 1.0.0.beta.1

pod install displays following error

MacBook-Pro:iOS-TuneIn home$ pod ins         


        
相关标签:
12条回答
  • 2020-12-07 10:24

    My podfile was formatted correctly, so the answer did not work for me. What I had to do was all of the following: First,

    1. gem uninstall cocoapods
    2. rvm get stable --auto-dotfiles
    3. rvm use ruby-2.1.2
    4. rvm osx-ssl-certs update all
    5. rvm rubygems latest
    6. sudo gem sources -r https://rubygems.org/
    7. sudo gem sources -a http://rubygems.org/
    8. gem install cocoapods -v 1.0.0.beta.1 --pre -V

    I had SSL errors, timeout errors, and path errors. This fixed all of these. I am adding this answer in hopes that it will help someone - most people with this issue will NOT need to go through all of these steps, and should not do so if it is not neccesary. Keep in mind, that this is changing the d/l link to not use https, so be sure to change it back once you have resolved this issue. This, this, and this Stack Overflow question helped me finally resolve these issues.

    0 讨论(0)
  • 2020-12-07 10:24

    Pod file is just a ruby file, you need to specify required pod for all target. one of the available solution is to define all required pods in shared_pos, and use that for each target.

    For ex:

    Podfile

    platform :ios, '9.0'
    
    use_frameworks!
    
    def Shared_Pods
        pod 'Quick', '0.5.0'
        pod 'Nimble', '2.0.0-rc.1'
    end
    
    target 'MyMainTarget' do
        Shared_Pods
    end
    
    target 'MyUITests' do
        Shared_Pods
    end
    
    0 讨论(0)
  • 2020-12-07 10:25

    You have to specify a target for each pod.

    e.g. if before you had your Podfile written like this:

    pod 'Alamofire', '~> 3.1.4'
    pod 'SwiftyJSON', '~> 2.3.2'
    

    just change it to

    target "TargetName" do
        pod 'Alamofire', '~> 3.1.4'
        pod 'SwiftyJSON', '~> 2.3.2'
    end
    
    0 讨论(0)
  • 2020-12-07 10:26

    1) Add and Open Podfile in Xcode instead of TextEdit or any other editor. (Syntax highlighting while viewing a pod file will simplify the process of finding syntax errors)

    2) Add project dependancies as follows in your Podfile

    def pods
      pod 'AFNetworking', '~> 2.6'
      pod 'ORStackView', '~> 3.0'
      pod 'SwiftyJSON', '~> 2.3'
    end
    

    3) Add above define pods in project target as follows

    target 'App_Target_Name' do
      pods
    end
    
    0 讨论(0)
  • 2020-12-07 10:27

    From the CocoaPods website:

    CocoaPods provides a pod init command to create a Podfile with smart defaults. You should use it.

    0 讨论(0)
  • 2020-12-07 10:36

    After the new changes to cocoapods, You have to add the following lines to your podfile.

    target "YOUR_PROJECT_NAME" do
    
         pod "YOUR_POD"
    
    end
    
    0 讨论(0)
提交回复
热议问题