Hello guys, I was little scared about CocoaPods setups in xcode and using old way to integrate libraries from 3rd parties.
Without a dependency management tool, you might simply add each library’s code to your project. However, this has several disadvantages:
Here we go with just few steps:
1.) Open Terminal and type the following command:
sudo gem update --system
Enter your password when requested. The Terminal output should look something like this:
Update may take a little while. Next, you need to install CocoaPods. Type this command in Terminal to do so:
sudo gem install cocoapods
You may get this prompt during the install process:
rake's executable "rake" conflicts with /usr/bin/rake
Overwrite the executable? [yN]
If so, just enter y to continue. (This warning is raised because the rake gem is updated as part of the install process. You can safely ignore it.)
Lastly, enter this command in Terminal to complete the setup of CocoaPods:
pod setup
This process will likely take a while as this command clones the CocoaPods Specs repository into ~/.cocoapods/ on your computer.
Great, you’re now setup to use CocoaPods!
Installing Your First Dependency
Open Terminal and navigate to the directory containing your project by using the cd command:
cd ~/Path/To/Folder/Containing/Xcode Project
Next enter this command:
pod init
It will create a Podfile for your project. The Podfile is where you define the dependencies your project re- lies on.
Type this command to open Podfile using Xcode for editing:
open -a Xcode Podfile
Replace# platform :ios, "6.0"with the following:
platform :ios, "7.0"
This tells CocoaPods that your project is targeting iOS 7.
Type the following into your pod file, right after
target "ProjectName" do:
pod 'AFNetworking', '2.2.1'
your pod command provided with 3rd party Libraries, it used.
Save and close the pod file.
You now need to tell CocoaPods to “install” the dependencies for your project. Enter the following command in Termi- nal to do so (making sure that you’re still in the directory containing the ShowTracker project and Podfile):
pod install
You should see output similar to the following:
Analyzing dependencies...
Downloading dependencies...
Installing AFNetworking 2.1.1...
Generating Pods project
Integrating client project
[!] From now on use `ProjectName.xcworkspace`.
Without a dependency management tool, you might simply add each library’s code to your project. However, this has several disadvantages:
- Wasting space.
- There’s no central place where you can see all libraries that are available.
Here we go with just few steps:
1.) Open Terminal and type the following command:
sudo gem update --system
Enter your password when requested. The Terminal output should look something like this:
Update may take a little while. Next, you need to install CocoaPods. Type this command in Terminal to do so:
sudo gem install cocoapods
You may get this prompt during the install process:
rake's executable "rake" conflicts with /usr/bin/rake
Overwrite the executable? [yN]
If so, just enter y to continue. (This warning is raised because the rake gem is updated as part of the install process. You can safely ignore it.)
Lastly, enter this command in Terminal to complete the setup of CocoaPods:
pod setup
This process will likely take a while as this command clones the CocoaPods Specs repository into ~/.cocoapods/ on your computer.
Great, you’re now setup to use CocoaPods!
Installing Your First Dependency
Open Terminal and navigate to the directory containing your project by using the cd command:
cd ~/Path/To/Folder/Containing/Xcode Project
Next enter this command:
pod init
It will create a Podfile for your project. The Podfile is where you define the dependencies your project re- lies on.
Type this command to open Podfile using Xcode for editing:
open -a Xcode Podfile
Replace# platform :ios, "6.0"with the following:
platform :ios, "7.0"
This tells CocoaPods that your project is targeting iOS 7.
Type the following into your pod file, right after
target "ProjectName" do:
pod 'AFNetworking', '2.2.1'
your pod command provided with 3rd party Libraries, it used.
Save and close the pod file.
You now need to tell CocoaPods to “install” the dependencies for your project. Enter the following command in Termi- nal to do so (making sure that you’re still in the directory containing the ShowTracker project and Podfile):
pod install
You should see output similar to the following:
Analyzing dependencies...
Downloading dependencies...
Installing AFNetworking 2.1.1...
Generating Pods project
Integrating client project
[!] From now on use `ProjectName.xcworkspace`.

No comments:
Post a Comment