Trying to prepare a single dynamic framework to my customer. My framework (A.framework) uses third-party recognition static framework (B.framework). I can’t provide separate A and B frameworks to the customer. Ideally B.framework should be built and included into my A.framework’s binary, so the customer’s app will only embed A.framework without any additional actions to link with that third-party app.
What I did:
- Added B.framework to the project.
- Added B.framework to “Linked Frameworks and Libraries” in the corresponding target.
- Built A.framework.
- Created a demo application and included A.framework to the project.
- Added A.framework to “Embedded Binaries”.
- Demo app’s build fails with message “Missing required module ‘B'” (despite the fact that it is used in A.framework only).
- I neither created any modulemap files for B.framework, nor additional run scripts
- Making A.framework static is not acceptable because it includes some resources (storyboards, icons and some other files)
- Tried to make un-recommended “umbrella” framework but got stuck on loading B.framework’s bundle in demo app
- Tried to make fake “umbrella” framework by simply copying B.framework inside A.framework, but got 2 problems – huge size of A.framework and Mach-O error while exporting the demo application (because of Mach-O difference between dynamic A and static B frameworks)
- All the projects have disabled bitcode
UPD 1: This is not about umbrella framework because the proper umbrella framework implementation requires to load sub-framework from bundle which is not good. The fake framework implementation (sub-framework simply copied to umbrella) won’t work for release because of different Mach-O values – dynamic and static. Plus fake umbrella framework has a huge size because sub-framework is being fully copied inside umbrella.
UPD 2: Created a small test project: StaticFrameworkTest which has 3 sub-projects:
- Demo-application with dynamic framework dependency (framework A) and shouldn’t know anything about framework B
- Dynamic framework with static framework dependency (framework B) which ideally should be included in A framework’s binary.
- Static framework B
UPD 3: After comprehensive search of a solution found similar thread here: https://forums.developer.apple.com/thread/86056. Similar to my case, @akhilcb faced an issue when he could build the project on my machine, but not on another (got “Missing required module Static Framework” error). Cleaning “Derived Data”doesn’t help.
Any ideas would be highly appreciated!
Powered by WPeMatico