xcframework does not contain internal frameworks(xcframework 不包含内部框架)
问题描述
我正在尝试为我正在使用的几个第三方库创建一个 .xcframework
文件.按照 https://appspector.com/blog/xcframeworks 的说明,我
I am trying to create an .xcframework
file for a few third party libraries I'm using. Following the instructions from https://appspector.com/blog/xcframeworks, I
- 创建特定于平台的
framework
文件:
# Archive for device
xcodebuild archive -scheme TestFramework -destination="iOS" -archivePath /tmp/xcf/ios.xcarchive -derivedDataPath /tmp/iphoneos -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
# Archive for simulator
xcodebuild archive -scheme TestFramework -destination="iOS Simulator" -archivePath /tmp/xcf/iossimulator.xcarchive -derivedDataPath /tmp/iphoneos -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
此时,我已经获得了两个带有 .swiftmodule
文件的框架;一切看起来都很好.框架确实不带有 .swiftinterface
文件,但我认为没关系,因为这些是 objc 项目.那么,我
At this point, I've gotten two frameworks with .swiftmodule
files; everything looks good. The frameworks do not come with .swiftinterface
files, but I think that is alright as these are objc projects. Then, I
- 将各个
framework
组合成一个单独的xcframework
文件:
- Combine the individual
framework
s to form a singlexcframework
file:
# Build xcframework with two archives
xcodebuild -create-xcframework -framework /tmp/xcf/ios.xcarchive/Products/Library/Frameworks/TestFramework.framework -framework /tmp/xcf/iossimulator.xcarchive/Products/Library/Frameworks/TestFramework.framework -output /tmp/xcf/TestFramework.xcframework
这里,xcodebuild
没有失败,但它会发出一个奇怪的错误:
Here, xcodebuild
doesn't fail, but it emits a curious error:
No 'swiftinterface' files found within '/Users/user/git/ReactiveObjC/output/xcf/ios.xcarchive/Products/Products/Library/TestFramework.framework/Modules/TestFramework.swiftmodule'.
至关重要的是,.xcframework
包不包含 Info.plist中指定的单个
framework
的 或 文件夹代码>文件.显然,当我尝试在这种状态下链接到 xcframework
时,我会收到一堆缺少符号"链接器错误.
Crucially, the .xcframework
package does not contain the individual framework
s or folders specified in the Info.plist
file. Obviously, when I try to link to the xcframework
in this state, I get a bunch of "missing symbols" linker errors.
这是为什么?我必须怎么做才能让 xcodebuild
完全创建 xcframework
?
Why is this? What must I do to get xcodebuild
to create the xcframework
completely?
注意:目前手动创建文件夹似乎可行,但这感觉不对而且很脆弱——Apple 可以随时更改 xcodebuild
的工作方式.
NB: Manually creating the folders seems to work for now, but this feels wrong and is brittle – Apple can change the way xcodebuild
works anytime.
推荐答案
原来在 xcodebuild
命令的末尾添加 BUILD_LIBRARY_FOR_DISTRIBUTION = YES
是不够的/不是努力使用所需的 swiftinterface
文件生成框架.我必须进入实际项目的设置并手动将 BUILD_LIBRARY_FOR_DISTRIBUTION
设置为 YES
,例如 这个答案 建议.在我得到带有 swiftinterface
文件的框架后,我就能够使用 xcodebuild
创建 xcframework
文件而没有任何问题.
Turns out that adding BUILD_LIBRARY_FOR_DISTRIBUTION = YES
to the end of the xcodebuild
command was not enough / not working to produce a framework with the required swiftinterface
files. I had to go in the settings for the actual project and manually set BUILD_LIBRARY_FOR_DISTRIBUTION
to YES
, like this answer suggests. After I got the frameworks with the swiftinterface
files, I was then able to create the xcframework
file using xcodebuild
without any problems.
这篇关于xcframework 不包含内部框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:xcframework 不包含内部框架


- Android - 拆分 Drawable 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01