Best practice: Manage third-party libraries with Cocoapods configuration

Source: Internet
Author: User

The book connected to the above (Cocoapods/pod installation of simple steps), after the local installation of CocoaPods, we began to configure the project and add a third-party library for Pod Management, the following practical operation, so that pod configuration is so simple (callout-red for us to enter manually, Black for the command line itself output):


First step: Verify that pod installation is successful

Zpodsdemo mapboo$ pod--version

0.38.2


Second step: Create the project, as usual, then open the terminal into the project root directory

~ mapboo$ Cd/users/mapboo/desktop/zpodsdemo

Zpodsdemo mapboo$ ls

Zpodsdemo zpodsdemo.xcodeproj zpodsdemotests



Step three: Create Pod management profiles

Zpodsdemo mapboo$ Touch podfile

Zpodsdemo mapboo$ ls-a

. podfilezpodsdemotests

.. zpodsdemo

. Ds_store zpodsdemo.xcodeproj


Note: More podfile files in the root directory


Fourth step: Search for third-party libraries to add Jsonkit

Zpodsdemo mapboo$ pod search Jsonkit


Gcjsonkit (1.5.0)

GC ' s fork of a Very high performance objective-c JSON Library.

Pod ' Gcjsonkit ', ' ~> 1.5.0 '

-Homepage:https://github.com/gamechanger/jsonkit

-Source:https://github.com/gamechanger/jsonkit.git

-versions:1.5.0 [master repo]



Jsonkit (1.5pre)

A Very High Performance objective-c JSON Library.

Pod ' Jsonkit ', ' ~> 1.5pre '

-Homepage:https://github.com/johnezang/jsonkit

-Source:https://github.com/johnezang/jsonkit.git

-Versions:1.5pre, 1.4 [master repo]



Jsonkit-nowarning (1.2)

A Very High Performance objective-c JSON Library.

Pod ' jsonkit-nowarning ', ' ~> 1.2 '

-Homepage:https://github.com/ignazioc/jsonkit-nowarning

-Source:https://github.com/ignazioc/jsonkit-nowarning.git

-versions:1.2, 1.1 [master Repo]



Sgjsonkit (1.2.4)

Auto-mapping JSON objects to OBJECTIVE-C classes

Pod ' Sgjsonkit ', ' ~> 1.2.4 '

-Homepage:http://github.com/dongminkim/sgjsonkit

-Source:https://github.com/dongminkim/sgjsonkit.git

-versions:1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2, 1.1.1, 1.1, 1.0 [master Repo]



Fifth step: Open the Podfile file, you can use VIM in the terminal or directly in the project right-click Text to open, enter the following code

Platform:ios

Pod ' Jsonkit ', ' ~> 1.5pre '


Sixth step: Start installing the third-party library

Zpodsdemo mapboo$ pod install--verbose--no-repo-update


Preparing


[!] Unable to load a specification for the plugin '/library/ruby/gems/2.0.0/gems/cocoapods-try-release-fix-0.1.2 '




Analyzing dependencies




Inspecting targets to integrate


Using ' archs ' setting to build architectures of target ' Pods ': (')




Resolving dependencies of ' podfile '




Comparing resolved specification to the sandbox manifest


A Jsonkit




Downloading dependencies




Installing Jsonkit (1.5PRE)


> Copying Jsonkit from


'/USERS/MAPBOO/LIBRARY/CACHES/COCOAPODS/PODS/RELEASE/JSONKIT/1.5PRE-EFEF3 ' to


' Pods/jsonkit '


-Running Pre Install hooks




Generating Pods Project


-Creating Pods Project


-Adding source files to Pods project


-Adding frameworks to Pods project


-Adding libraries to Pods project


-Adding Resources to Pods project


-Linking headers


-Installing targets


-Installing target ' jsonkit ' IOS 4.3


-Installing target ' Pods ' IOS 4.3


-Running Post Install hooks


-Writing Xcode project file to ' Pods/pods.xcodeproj '


-Writing Lockfile in ' Podfile.lock '


-Writing Manifest in ' Pods/manifest.lock '




Integrating client Project




[!] Please close any current Xcode sessions and use ' Zpodsdemo.xcworkspace ' for this project from now on.




Integrating target ' Pods ' (' Zpodsdemo.xcodeproj ' project)


Adding Build Phase ' Copy Pods Resources ' to project.


Adding Build Phase ' Check Pods manifest.lock ' to project.


-Running Post Install hooks


-Cocoapods-stats from


'/library/ruby/gems/2.0.0/gems/cocoapods-stats-0.5.3/lib/cocoapods_plugin.rb '




Sending stats


-Jsonkit, 1.5pre


Failed to send Stats:ssl_connect returned=1 errno=0 state=sslv2/v3 Read


Server Hello A:sslv3 alert handshake failure

After the installation is complete, look at the project directory as follows:



Sixth step: Configure the third-party library path, the source project can introduce relative path header file


${srcroot} recursive


Configuration



Front and rear contrast


Seventh Step: Change third-party libraries


If you have modified, updated, or added a third-party library, you can open the Podfile file directly, for example, as entered below:

Platform:ios

Pod ' reachability ', ' ~> 3.0.0 '


Then run the command again

Zpodsdemo mapboo$ pod Install--verbose--no-repo-update


is equivalent to deleting the previous Jsonkit library and adding the reachability library



Eighth Step: Open the Project double-click Zpodsdemo.xcworkspace to start normal development;


At this point, we complete the actual operation of a pod management of the third-party library of the entire process, no longer have to worry about the third-party library update problem, everyone, I am Z, next time, more excellent blog, can download it interview treasure-blog recommendation column under reading.



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Best practice: Manage third-party libraries with Cocoapods configuration

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.