XCode下面一个Swift版本错误的临时处理方式

项目环境:
Unity版本 2022.3.62f2
XCODE 16.4 (16F6)
IOS Simulator 18.5

1
2
3
4
5
6
XCode在Build的时候报告错误:
Undefined symbol: __swift_FORCE_LOAD_$_swiftCompatibility50
Undefined symbol: __swift_FORCE_LOAD_$_swiftCompatibility51
Undefined symbol: __swift_FORCE_LOAD_$_swiftCompatibility56
Undefined symbol: __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency
Undefined symbol: __swift_FORCE_LOAD_$_swiftCompatibilityDynamicReplacements

尝试:

1
2
3
4
5
6
7
8
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.9' # 根据你的项目设定
config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES' #危险
end
end
end

尝试清缓存:

1
2
3
4
pod deintegrate
pod cache clean --all
rm -rf ~/Library/Developer/Xcode/DerivedData
pod install --repo-update

均无效,
最终解决方式,

  1. 在导出的项目里面建立一个空文件,比如:Untitled.swift
  2. 导入到项目的Target-iPhone项目下面, 最终得到解决