XCFramework with static frameworks sub dependencies

2.3k views Asked by At

I have a XCFramework which depends upon several static frameworks.

My XCFramework is built with BUILD_FOR_LIBRARIES_FOR_DISTRIBUTION enabled.

The sub frameworks don't need to be accessible from outside the XCFramework.

When I try to compile my XCFramework in the client(host) app, I am getting en error in the XCFramework's .swiftinterface file saying No such module 'FBSDKLoginKit' (FBSDKLoginKit is one of the XCFramework sub frameworks)

What seems to be missing is the swiftinterface files for the dependent modules. For example, I am using FBSDKLoginKit but the swiftinterface is not there within the XCFramework.

For reference I'm compiling the the framework as follows:

xcodebuild archive -project "TestFrameowrk.xcodeproj" -scheme "TestFrameowrk" -sdk iphoneos -archivePath ~/Desktop/xcframework.arm SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES

xcodebuild archive -project "TestFrameowrk.xcodeproj" -scheme "TestFrameowrk" -sdk iphonesimulator -archivePath ~/Desktop/xcframework.x86 SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES

xcodebuild -create-xcframework -framework ~/Desktop/xcframework.x86.xcarchive/Products/Library/Frameworks/TestFrameowrk.framework  -framework ~/Desktop/xcframework.arm.xcarchive/Products/Library/Frameworks/TestFrameowrk.framework -output ~/Desktop/Framework.xcframework
2

There are 2 answers

0
XCFrameworkSuggestion On

Did you try adding other dependencies separately with your created XCFramework when you integrate with client project? Looks like, apple recommends to avoid using umbrella/nested frameworks with XCFramework.

0
TheCodeTalker On

Yes I had same issue happening with alamofire dependency . so what happening is when you generate xcframeworks you have dependency with FBSDKLoginKit fine . But after generating frameworks your client want to use .you also have to mention dependency as FBSDKLoginKit with same version then this problem not happen . For me I solves after adding alamofire adding in client side.