Friday 22 January 2016

Install CocoaPods

POD Install:

1) Open terminal 

2) $ sudo gem install cocoapods (gem will get installed in Ruby inside System library)

3) Enter this command in Terminal to complete the setup:
    $ pod setup


4) Install Command line tool of Xcode.
    $ xcode-select --install

5) Verify that you’ve successfully installed Xcode Command Line Tools:
$ xcode-select -p /Library/Developer/CommandLineTools

6) Create a xcode project. 

7) cd "path to your project root directory"

8) Create Podfile in your project.
    $ pod init 

9) open -a Xcode Podfile 

Podfile will get open in text mode. 
You shouldn’t use TextEdit to edit the Podfile because it likes to replace standard quotes with more graphically appealing typeset quotes. This can cause CocoaPods to become confused and results in errors being thrown, so it’s best to use Xcode or another programming text editor to edit your Podfile.


The default Podfile looks like this:

# Uncomment this line to define a global platform for your project
#platform :ios, '8.0'
# Uncomment this line if you're using Swift
#use_frameworks!

target ‘TestPod’ do

end




Replace the commented lines with the following:

# Uncomment this line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!

This tells CocoaPods that your project is targeting iOS 8.0 and will be using frameworks instead of static libraries.



10) pod 'AFNetworking', '~> 3.0'

  It’s finally time to add your first dependency using CocoaPods! Copy and paste the following into your pod file, right after target “TestPod” do:

11) Now close pod file and execute below command on terminal
      $ pod install

Now close your xcode project and open .xcworkspace xcode project file.





No comments:

Post a Comment