On July 5, 2016
主要三个步骤:
1: 工程根目录下新建一个文件Cartfile
2: carthage update
3: 把获取到的.framework(UseCarthage/Carthage/Build/iOS/Alamofire.framework)文件拖入项目中
new UseCarthage project
cd UseCarthage path
➜ UseCarthage carthage version
0.17.1
➜ UseCarthage touch Cartfile 在UseCarthage的根目录下新建一个文件Cartfile
➜ UseCarthage oepn -a Xcode Cartfile 用Xcode打开Cartfile并且编辑
➜ UseCarthage carthage update 拉取源代码并编译为 Framework
*** Fetching Alamofire
*** Checking out Alamofire at "3.4.1"
*** xcodebuild output can be found in /var/folders/k6/rb8qdg1s1_9_kqxvqr5s5mb80000gn/T/carthage-xcodebuild.KcHFZm.log
*** Building scheme "Alamofire OSX" in Alamofire.xcworkspace
*** Building scheme "Alamofire watchOS" in Alamofire.xcworkspace
*** Building scheme "Alamofire tvOS" in Alamofire.xcworkspace
*** Building scheme "Alamofire iOS" in Alamofire.xcworkspace
➜ UseCarthage
Cartfile
你需要哪些依赖库,相当于Podfile
Cartfile.resolved
跟踪项目当前所用的依赖版本号
Carthage
存放依赖库的源文件和编译后的文件
- Build
- iOS - Alamofire.framework
- Mac - Alamofire.framework
- tvOS - Alamofire.framework
- watchOS - Alamofire.framework
- Checkouts
- Alamofire
- ... xxx.xcodeproj ...
把获取到的.framework
(UseCarthage/Carthage/Build/iOS/Alamofire.framework)文件拖入项目中
在编译的时候你可能会遇到直接crash 报错:
dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire
Referenced from: /Users/~/Library/Developer/CoreSimulator/Devices/267F110E-C0C2-4507-9DA0-BE119D4871D3/data/Containers/Bundle/Application/973D7627-758A-453B-ABDE-89556E7186DA/UseCarthage.app/UseCarthage
Reason: image not found
(lldb)