问题描述
我有一个依赖于几个静态框架的 XCFramework.
I have a XCFramework which depends upon several static frameworks.
我的 XCFramework 是在启用 BUILD_FOR_LIBRARIES_FOR_DISTRIBUTION 的情况下构建的.
My XCFramework is built with BUILD_FOR_LIBRARIES_FOR_DISTRIBUTION enabled.
不需要从 XCFramework 外部访问子框架.
The sub frameworks don't need to be accessible from outside the XCFramework.
当我尝试在客户端(主机)应用程序中编译我的 XCFramework 时,我在 XCFramework 的 .swiftinterface 文件中出现错误提示 No such module 'FBSDKLoginKit'
(FBSDKLoginKit 是 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)
似乎缺少的是依赖模块的 swiftinterface 文件.例如,我使用的是 FBSDKLoginKit,但 XCFramework 中没有 swiftinterface.
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
推荐答案
是的,我在 alamofire 依赖项中遇到了同样的问题.所以发生的事情是当你生成 xcframeworks 时,你对 FBSDKLoginKit 有依赖关系.但是在生成您的客户想要使用的框架之后.您还必须提到具有相同版本的 FBSDKLoginKit 的依赖关系,然后这个问题就不会发生.对我来说,我在客户端添加 alamofire 添加后解决了.
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.
这篇关于具有静态框架子依赖项的 XCFramework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!