简体   繁体   中英

Xcode12.4 - iOS Umbrella xcframework framework with xcframework sub projects

I want to have some XCFrameworks into an umbrella framework or umbrella xcframework using Xcode 12.4 for iOS. I tried all the approaches mentioned in these threads. However, I am not able to get it working for any of the swift classes in my client app.

Note that this works seamlessly with ObjC classes.

Umbrella framework

XCFramework with static frameworks sub dependencies

Approach 1 - Create.framework

When I build a.framework by adding sub xcframeworks to copy framework build phase, I see that xcframework subprojects are extracted to static libraries ".a" files. I import this.framework in my application which is ObjC + Swift, I get "No such modules" error for all the subprojects in all the swift classes which imports the umbrella framework

Approach 2 - Create.xcframework

When I create a.xcframework with all xcframework sub projects, I get No such module 'XXXX' error in x86_64-apple-ios-simulator.swiftinterface when I use the umbrella framework in the client app

Note that I am linking and embedding the umbrella / xcframework in client app.

Another Thought

Also, when I create a sample app with Xcode 12.4 and import the same umbrella framework/.xcframework, everything works fine. Is this something to do with the client app.xcodeproj created in older versions of XCode?

Some things to try:

  1. Make sure to have BUILD_LIBRARY_FOR_DISTRIBUTION set.

  2. Link the sub frameworks statically. If you are including the other frameworks using CocoaPods, make sure you specify use_frameworks: :linkage => :static .

  3. In your source files where you use the sub-frameorks, write @_implementationOnly import SomeFramework .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM