Chris G.
Chris G.

Reputation: 25934

Using Carthage in frameworks

I have created two frameworks in Xcode.
Within each framework I use Carthage to get external frameworks.

I have the following setup(Hope it makes sense):

- MyNetworksFramework
-- Framework reference(via Carthage): Alamofire

- MyUIFramework
-- Framework reference(via Xcode): NetworksFramework
-- Framework reference(via Carthage): RxSwift

- MyApp
-- Framework reference(via Xcode): UIFramework

I have had no problems in the Emulator, but when running on a device I get errors like:dyld: Library not loaded... RxSwift.

I have added each of my custom frameworks to embedded frameworks under "General".

Am I missing some external framework setting?

Upvotes: 3

Views: 1047

Answers (1)

totiDev
totiDev

Reputation: 5265

I had the same issue in the past. What was needed to get this fixed is to run the carthage copy-frameworks command that they mention on Github. But rather than put the copy-frameworks build phase on each of the frameworks, is you need to put the copy-frameworks in your MyApp build phase. In your case in MyApp you would add Alamofire and RXSwift. Also remove the copy-frameworks from MyNetworksFramework and MyUIFramework.

This is what my script in Build Phases looks like: Build Phase for Carthage copy-frameworks

Upvotes: 3

Related Questions