[ios] Updating to latest version of CocoaPods?

I'm having some issues installing Alamofire 4.0 into my project.

I've got the latest version of Xcode, running Swift 3, and when I try to install alamofire I'm getting like 800 compiler errors.

Apparently

CocoaPods 1.1.0+ is required to build Alamofire 4.0.0+

I looked at the version of CocoaPods I have in terminal and it says I'm at 1.0.1.

Running an update didn't work I guess because CocoaPods 1.1 is in beta.

So I'm not exactly sure how to update it up to where I'm good to go. Unless being out of date doesn't force like 800 compiler errors? Does that sound like some other issue?

This question is related to ios swift xcode cocoapods

The answer is


Refer this link https://guides.cocoapods.org/using/getting-started.html

brew install cocoapods

brew upgrade cocoapods

brew link cocoapods

enter image description here

enter image description here


I tried updating and it didn't work. Finally , I had to completely remove (manually )cocoapods, cocoapods-core , cocoapods-try.. and any other package used by cocoapods. Use this terminal command to list all the packages:

gem list --local | grep cocoapods

After that , I also deleted ./cocoapods folder from the user's root folder.


First check cocoapods version
like pod --version
then update like sudo gem install cocoapods --pre

after update you can also check cocoapods version.

enter image description here


If you are using Homebrew, open terminal and type:

brew upgrade cocoapods

If that does not work, try:

brew install cocoapods

If you got System Integrity Protection enabled or any other permission write error, which is enabled by default since macOS Sierra release, you should update CocoaPods, running this line in terminal:

sudo gem install cocoapods -n/usr/local/bin

After installing, check your pod version:

pod --version

You will get rid of this error:

ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory

And it will install latest CocoaPods:

Successfully installed cocoapods-x.x.x
Parsing documentation for cocoapods-x.x.x
Installing ri documentation for cocoapods-x.x.x
Done installing documentation for cocoapods after 4 seconds
1 gem installed

This is a really quick & detailed solution

Open the Terminal and execute the following to get the latest stable version:

sudo gem install cocoapods

Add --pre to get the latest pre release:

sudo gem install cocoapods --pre

Incase any error occured

Try uninstall and install again:

sudo gem uninstall cocoapods
sudo gem install cocoapods

Run after updating CocoaPods

sudo gem clean cocoapods

After updating CocoaPods, also need to update Podfile.lock file in your project.

Go to your project directory

pod install

Below are steps to update cocoapods :

  1. Open terminal (Shortcut : Press cmd + space tab to open Spotlight then text in terminal)
  2. Use command sudo gem install cocoapods. This will ask for system password due to security concern thereafter it installs gems

Screenshot 1

  1. Now, set up pod using pod setup command. This will setup cocoapods master repo.

Screenshot 2

  1. You can check the version of cocoapods using pod --version command.

Screenshot 3


You can solve this problem by these Commands:

First:

sudo gem install cocoapods

Desp: type user mac password now your cocoapods will be replace with a stable version.

You can find out where the CocoaPods gem is installed with:

gem which cocoapods

if you have cloned the repo then type this command:

pod repo update

close your xcode and run this command

Pod install

Open the Terminal -> copy below command

sudo gem install cocoapods

It will install the latest stable version of cocoapods.

after that, you need to update pod using below command

pod setup

You can check pod version using below command

pod --version

Using CocoaPods with a Gemfile

With a Gemfile setup, you run bundle install to install, or bundle update to update within your Gemfile's constraints. From here on in however, you will need to remember to run bundle exec before any terminal commands that have come in via bundler. Given that CocoaPods is included in the above this means any time you would write pod XX YY you need to do bundle exec pod XX YY.

Doing it without bundle exec will bypass your Gemfile's specific versioning and will use the latest version of the library within RubyGems. This could potentially be the exact same version, but it can often not. If you are including CocoaPods plugins then they may also not be run.

This means you can be sure that foundational tooling for projects are versioned just like your personal libraries.


For those with a sudo-less CocoaPods installation (i.e., you do not want to grant RubyGems admin privileges), you don't need the sudo command to update your CocoaPods installation:

gem install cocoapods

You can find out where the CocoaPods gem is installed with:

gem which cocoapods

If this is within your home directory, you should definitely run gem install cocoapods without using sudo.

Finally, to check which CocoaPods you are currently running type:

pod --version

Non of the above solved my problem, you can check pod version using two commands

  1. pod --version
  2. gem which cocoapods

In my case pod --version always showed "1.5.0" while gem which cocopods shows Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods.rb. I tried every thing but unable to update version showed from pod --version. sudo gem install cocopods result in installing latest version but pod --version always showing previous version. Finally I tried these commands

  1. sudo gem update
  2. sudo gem uninstall cocoapods
  3. sudo gem install cocopods
  4. pod setup``pod install

catch for me was sudo gem update. Hopefully it will help any body else.


I change the line "pod 'Alamofire', '~> 4.0'" to "pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire', :commit => '3cc5b4e'" after that in terminal: "pod install --repo-update" and it works.


Examples related to ios

Adding a UISegmentedControl to UITableView Crop image to specified size and picture location Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods Keep placeholder text in UITextField on input in IOS Accessing AppDelegate from framework? Autoresize View When SubViews are Added Warp \ bend effect on a UIView? Speech input for visually impaired users without the need to tap the screen make UITableViewCell selectable only while editing Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

Examples related to swift

Make a VStack fill the width of the screen in SwiftUI Xcode 10.2.1 Command PhaseScriptExecution failed with a nonzero exit code Command CompileSwift failed with a nonzero exit code in Xcode 10 Convert Json string to Json object in Swift 4 iOS Swift - Get the Current Local Time and Date Timestamp Xcode 9 Swift Language Version (SWIFT_VERSION) How do I use Safe Area Layout programmatically? How can I use String substring in Swift 4? 'substring(to:)' is deprecated: Please use String slicing subscript with a 'partial range from' operator Safe Area of Xcode 9 The use of Swift 3 @objc inference in Swift 4 mode is deprecated?

Examples related to xcode

Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64 iPhone is not available. Please reconnect the device Make a VStack fill the width of the screen in SwiftUI error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65 The iOS Simulator deployment targets is set to 7.0, but the range of supported deployment target version for this platform is 8.0 to 12.1 Xcode 10.2.1 Command PhaseScriptExecution failed with a nonzero exit code Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Xcode 10: A valid provisioning profile for this executable was not found Xcode 10, Command CodeSign failed with a nonzero exit code

Examples related to cocoapods

Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods The iOS Simulator deployment targets is set to 7.0, but the range of supported deployment target version for this platform is 8.0 to 12.1 Xcode 10.2.1 Command PhaseScriptExecution failed with a nonzero exit code Updating to latest version of CocoaPods? 'Linker command failed with exit code 1' when using Google Analytics via CocoaPods ld: framework not found Pods How to update a single pod without touching other dependencies Error "library not found for" after putting application in AdMob cocoapods - 'pod install' takes forever Xcode - ld: library not found for -lPods