Carthage-A simple, centralized cocoa dependency manager

Source: Internet
Author: User

Project Source Address: Https://github.com/Carthage/Carthage

Think of Ios/os X project's dependency management, the first thought must be the famous cocoapods. Here is a description of the difference between the two Carthage:

CocoaPods (default) automatically establishes and updates a Xcode workspace, which is used to manage your projects and all dependencies. Carthage uses Xcodebuild to compile the binary library, and the rest of the integration work is left entirely to the developer.

The cocoapods is easy to use, Carthage more flexible and does not have much aggressiveness for existing projects.

Cocoapods wants to build an ecosystem that makes it easier to discover and integrate third-party code repositories. Carthage wants to become a centralized dependency management system that does not provide a centralized list of projects, reducing maintenance costs and the probability of a single point of failure. However, it is inconvenient for developers to find projects.

The Cocoapods project requires configuration of the Podspec file, which contains information about the project and the third-party library. Carthage does not use a similar configuration file, the dependencies of third-party libraries are configured through the Xcode project.

Installing Carthage

1. Download the installation package directly: address, but the file host on Amazon S3, I tried several times did not ...

2. Using Homebrew

  Update    Install Carthage

3. Enter Project creation
Vim Cartfile

Cartfile content Examples such as the following
    • >= 1.0  for" At least version 1.0 "1.0 or more
    • ~> 1.0  for "compatible with version 1.0" preferably 1.0,
    • == 1.0  for" Exactly version 1.0 "must be 1.0
    • Do not write anything, the default is the latest version of
"  snapkit/masonry  "
4. Terminal operation
Carthage Update
The results of running Carthage Update are as follows

Dongweideimac:testcarthage dongwei$ Carthage Update

*** Cloning Masonry

*** Checking outmasonry at "v1.0.0"

*** xcodebuild output can found in /var/folders/xy/dys150sn02q07gyq2fhn552w0000gn/t/carthage-xcodebuild.ypmhuh.log

*** Building Scheme "Masonry OSX" in masonry.xcworkspace

Dongweideimac:testcarthage dongwei$

The file directory is as follows



Where files Cartfile, cartfile.resolved, and Carthage folders are created with the Carthage, the other projects themselves take the 5. Open the Carthage folder to enter Bulid. Take Mac as an example and go to the Mac folder to find Masonry. The framework dragged into the project or, in the project, select Target, Build phases, Link Library with Librarie Click the + sign, and then click Add Other in the lower left corner to find it. The framework is added on the line

6. Add script in Build phases + (upper left corner), New Run script phase then, click the Run script to add the script
/usr/local/bin/carthage Copy-frameworks
Finally add "Input Files" (Take Alamofire as an example)
$ (srcroot)/carthage/build/ios/masonry. Framework




The role of the added script will run when the App Store submits a generic binary trigger bug, ensuring that the necessary bitcode related files are copied when the file is archived. This script works around a App Store submission bug triggered by universal binaries and ensures that necessary bitcode-re lated files is copied when archiving. It is also important to note that Carthage supports each version of OS X, but iOS 8 and above only officially supports dynamic frameworks are supported. The Dynamic frameworks can is used on any version of OS X, but only on IOS 8 or later. Finally, attach Carthage's github address: https://github.com/Carthage/Carthage

Carthage-A simple, centralized cocoa dependency manager

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.