gpt4 book ai didi

ios - 错误 : using bridging headers with module interfaces is unsupported Command CompileSwiftSources failed with a nonzero exit code

转载 作者:行者123 更新时间:2023-12-04 14:11:11 37 4
gpt4 key购买 nike

我已经为我的一个静态库应用程序切换到 Xcode12。我正在尝试进行 XCFramework 分发。运行构建命令后,

xcodebuild archive -scheme "MySDK" -sdk iphoneos  -archivePath “./archives/ios.xcarchive” -SKIP_INSTALL=NO

当我将 Build Settings -> Build Libraries for Distribution 切换为 YES 时出现以下错误,

<unknown>:0: error: using bridging headers with module interfaces is unsupported
Command CompileSwiftSources failed with a nonzero exit code

** ARCHIVE FAILED **


The following build commands failed:
CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler
CompileSwiftSources normal armv7s com.apple.xcode.tools.swift.compiler
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(3 failures)

This answer有效,但不幸的是创建 .xcframework 需要设置选项分布 YES

如何解决这个问题?

最佳答案

Apple 似乎不赞成使用桥接头而支持模块,但是 their documentation缺少有关如何 包含 C header 的信息。该信息可在更详细的 clang docs 中找到.

尝试从项目设置中删除桥接 header ,而是创建一个 module.modulemap 文件:

module MySdk {
header "MySdk-Bridging-Header.h"
export *
}

这有一些注意事项,例如需要在您的 swift 代码中导入 MySdk 并理解 C 函数将被公开,但这让我克服了困难。

我通过反复试验发现的一个技巧是将此模块映射文件和 C header 包含在框架的 Headers 文件夹中。这允许任何使用该框架的应用程序自动将 MySdk 检测为一个模块。

关于ios - 错误 : using bridging headers with module interfaces is unsupported Command CompileSwiftSources failed with a nonzero exit code,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64216881/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com