I have an Xcode workspace where I am building a framework, MainFramework
. This framework uses Cocoapods with two dependencies, SubFrameworkA
and SubFrameworkB
.
I would like to provide MainFramework.framework
to other apps, without needing them to manually include SubFrameworkA
and SubFrameworkB
- or even better (but not necessary), also without them knowing that I've used these sub frameworks. I currently use this post-archive script to create a universal framework for simulators and devices.
When I drag MainFramework.framework
to a brand new SampleApp
Xcode project, add it to "Frameworks, Libraries, and Embedded Content", and make sure it is set to "Embed & Sign", the app crashes when it launches with this error:
dyld: Library not loaded: @rpath/SubFrameworkA.framework/SubFrameworkA
Referenced from: /Users/dgcko/Library/Developer/CoreSimulator/Devices/092DD076-BB48-42B7-8D2A-166EE3A1F0D5/data/Containers/Bundle/Application/E1BA51D7-5F2F-4E0F-B88F-D3244AA934EB/SampleApp.app/Frameworks/MainFramework.framework/MainFramework
Reason: image not found
What I've read:
Creating an Umbrella framework is not recommended by Apple, as I do not own the sub frameworks. And if SampleApp wants to use one of the SubFrameworks, there will be clashes as there will be two versions of the sub frameworks in their project (theirs and the one in MainFramework).
According to this issue, it doesn't seem possible as the SubFrameworks are dynamically linked.
This answer also seems to suggest the same - SampleApp needs to also manually include the sub frameworks.
Does anybody know if what I am trying to do is possible, somehow? Any help would be much appreciated.