I am new to iOS linking/frameworks, so this can be a primary query.
I’ve:
DependencySDK.xcframework (static)
and
MySDK.xcframework
MySDK makes use of DependencySDK.
Case 1 – MySDK is Dynamic
I construct MySDK as:
Mach-O Kind = Dynamic Library
Then I create MySDK.xcframework and add solely MySDK to my app.
App
└── MySDK.xcframework
The app builds and runs efficiently.
Case 2 – MySDK is Static
I construct MySDK as:
Mach-O Kind = Static Library
Then I create MySDK.xcframework and once more add solely MySDK to my app.
App
└── MySDK.xcframework
This time the app fails to construct with:
Undefined symbols
for symbols coming from DependencySDK.
What I am confused about
I believed static libraries had been supposed to incorporate their dependencies greater than dynamic libraries.
So I anticipated:
* Dynamic MySDK → ought to want DependencySDK individually
* Static MySDK → ought to work by itself
However I am seeing the alternative.
My questions
1. Why does the dynamic model work despite the fact that I do not add DependencySDK to the app?
2. Is Xcode in some way together with DependencySDK contained in the dynamic framework?
3. Why does the static model fail with undefined symbols?
4. If I wish to distribute just one XCFramework, what’s the really useful method?
Any clarification of what’s occurring behind the scenes could be actually useful. I am nonetheless studying how static/dynamic linking works in iOS. Thanks!
