Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Carthage Support to an Existing Project

I've forked the AEXML project and I'm trying add Carthage support. I've added a framework target and a created a new Scheme that is marked as shared (see screenshots below). I am able to run carthage build and in my Carthage/Build/iOS I see:

enter image description here

When dragging the resulting AEXML.framework file into my example application the project will build however upon launching I receive:

enter image description here

I feel that I've messed up along the way somewhere but I'm not exactly sure how to go about fixing this.

enter image description here

like image 345
Kyle Decot Avatar asked Sep 29 '15 14:09

Kyle Decot


2 Answers

I had tried to do this by myself by adding to the script to check if each framework was found in the BUILD_PRODUCTS_DIR and then recursively copying them, if not. When that didn't work, I ended up with this linking issue:

dyld: Library not loaded: @rpath/XCTest.framework/XCTest Referenced from: .../build/Products/Debug-iphonesimulator/Specta.framework/Specta Reason: image not found

I finally tried creating the copy files phase and included my frameworks and dSYMs, creating groups, then moved all these to the Frameworks group in Xcode 7.2. My linking issues were completely gone.

like image 97
Paul Crowell Avatar answered Sep 28 '22 06:09

Paul Crowell


You should add run script at your example project's "Build Phase", like:

On your application targets’ “Build Phases” settings tab, click the “+” icon and > choose “New Run Script Phase”. Create a Run Script with the following contents:

 /usr/local/bin/carthage copy-frameworks

and then add the paths to the frameworks you would like to use under “Input Files”, e.g.:

 $(SRCROOT)/Carthage/Build/iOS/Box.framework
 $(SRCROOT)/Carthage/Build/iOS/Result.framework
 $(SRCROOT)/Carthage/Build/iOS/ReactiveCocoa.framework
like image 22
Abner Zhong Avatar answered Sep 28 '22 05:09

Abner Zhong