小编Vit*_*ich的帖子

使用 Xcode14 编译时,出现错误:不支持 Swift 架构。怎么解决这个问题呢?

切换到 xcode 14 构建系统后。为我们的 pod 框架生成的标头开始看起来像这样:

#if 0
#elif defined(__arm64__) && __arm64__
// Generated by Apple Swift version 5.7 (swiftlang-5.7.0.127.4 clang-1400.0.29.50)
... bridging for arm64
#else
#error unsupported Swift architecture
#endif
#if 0
#elif defined(__x86_64__) && __x86_64__
// Generated by Apple Swift version 5.7 (swiftlang-5.7.0.127.4 clang-1400.0.29.50)
... bridging for x86
#else
#error unsupported Swift architecture
#endif
Run Code Online (Sandbox Code Playgroud)

如果我查看标题,我会看到以下场景:

arm64 已定义且 x86 已定义 - 应该没问题 arm64 已定义而 x86 未定义 - 应该是错误 arm64 未定义而 x86 已定义 - 应该是错误 因此为了避免错误,应定义两种架构。这会导致客户端应用程序构建失败并出现错误:错误不支持的 Swift 架构。

即使 ONLY_ACTIVE_ARCH …

xcode build ios swift xcode14

20
推荐指数
2
解决办法
1万
查看次数

标签 统计

build ×1

ios ×1

swift ×1

xcode ×1

xcode14 ×1