Vit*_*ich 20 xcode build ios swift xcode14
切换到 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 = 0,这也可能应该是修补程序。我仍然收到此错误。
有谁知道为什么预编译头现在需要两种架构。以及如何修复构建错误?
如果您使用的是Xcode 14。只需将此代码粘贴到您的podfile中
post_install do |pi|
pi.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
end
end
end
Run Code Online (Sandbox Code Playgroud)
对我们有帮助的解决方案:
在构建框架时,我们使用-arch arm64or-arch arm64和 为不同的架构构建框架,然后加入它们。
Apple 改变了生成桥接标头的方式,此解决方案因我附加的标头格式而失败。
我们的解决方案就是删除 -arch 并构建 fat 框架。
| 归档时间: |
|
| 查看次数: |
14551 次 |
| 最近记录: |