10

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

3 Answers 3

1

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.

1

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
1
  • 1
    You should add link reference to the quote. Commented Oct 8, 2015 at 11:37
0

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.

You can do this here: Xcode target settings

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.