IOS tools-CocoaPods

Source: Internet
Author: User

IOS tools-CocoaPods

There are many third-party frameworks in the iOS development process, which is very convenient for developers to use the least code to complete the best apps. A launch project uses a lot of frameworks. If we add them one by one, this is especially slow. It is not the focus, but it is still prone to errors. For example, if the frame for loading AMAP is particularly complex and the environment is adapted, an unknown strange error will occur if one step fails. So a shell command editor is ready for use-CocoaPods

Build a ruby Environment

Note: In 2015, Apple launched iOS9 and replaced the http protocol with https. Therefore, CocoaPods may not be able to be installed smoothly if you see other documents, therefore, the article I wrote is fully adapted to the new environment.

Open the terminal and enter the ruby installation command

$ Gem sources-add https://ruby.taobao.org/-remove https://rubygems.org/

Check whether the installation is successful in a few minutes.

$ Gem sources-l

If the following words appear, the ruby environment is successfully installed.

* Current sources *
Http://ruby.taobao.org/

Install CocoaPods In the last step after the environment is set up
  $ sudo gem install cocoapods
Use CocoaPods1.
Cd to target project
2. Create a Podfile

You can use Xcode to create or use shell command lines (it is recommended to use command lines to create)

1. create Podfile: touch Podfile 2. edit the Podfile as follows: // take AMAP as an example. platform: ios, '7. 0' # Do not add this line to the mobile phone system at all. If you do not add this line, it will adapt to the 4.3 system. We suggest you add it, now it is no longer applicable to pod 'amap3dmap' # 3D map SDK # pod 'amap2dmap' # 2D map SDK (2D and 3D cannot be used at the same time? Use) pod 'amapsearch' # search service SDK
3. Input: wq to save 4. Install a third-party framework
 pod install

If you have installed and want to update

  pod update
After the installation is successful
 localhost:yourWorkDir yourUserName$ pod installAnalyzing dependenciesDownloading dependenciesInstalling AMap3DMap(2.4.0)Installing AMapSearch (2.4.0)Generating Pods projectIntegrating client project ![!] From now on use `yourProj.xcworkspace`.

I use CocoaPods on different computers and find that the command "pod install" appears

Updating local specs repositories

No progress was made after several minutes because our computer was not on the wall.
So in step 3, if your computer does not go over the wall, you can replace it

    pod install --verbose --no-repo-update

In this way, 666 is running.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.