Reputation: 20815
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:
When dragging the resulting AEXML.framework
file into my example application the project will build however upon launching I receive:
I feel that I've messed up along the way somewhere but I'm not exactly sure how to go about fixing this.
Upvotes: 10
Views: 1794
Reputation: 51
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
Upvotes: 1
Reputation: 9
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.
Upvotes: 1
Reputation: 6204
The error you have points that framework binary was not found at runtime. Answer by Abner Zhong will work in most cases, but sometimes you have to try harder (for me it was unit tests target). To make it work Carthage README suggests:
In rare cases, you may want to also copy each dependency into the build product (e.g., to embed dependencies within the outer framework, or make sure dependencies are present in a test bundle). To do this, create a new “Copy Files” build phase with the “Frameworks” destination, then add the framework reference there as well.
Upvotes: 0