Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 253
Chris G. Avatar asked Jul 14 '26 19:07

Chris G.


1 Answers

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

like image 66
totiDev Avatar answered Jul 17 '26 14:07

totiDev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!