原因
今天升级xcode 12.2最新版,然后编译出现下面错误。
Module compiled with Swift 5.3 cannot be imported by the Swift 5.3.1 compiler: /Users/tdw/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/SwiftyJSON/SwiftyJSON.swiftmodule/armv7-apple-ios.swiftmodule
翻译过来就是 之前的模块用的swift5.3编译的。不能被5.31的编译器import导入.
错误原因是:老得swift模块,不能被最新的xcode使用。
解决方法:
到swift官方下载一个工具
Toolchain
https://swift.org/download/#releases
选择 xcode 12.2我当前的版本
下载完以后安装swift-5.3.1-RELEASE-osx.pkg
文件很大753M,可以右键复制链接,然后用迅雷下载
安装完以后在xcode里面左上角点击xcode菜单打开能找到Toolchains
选择xcode12.2。你下载以后选择最新版本就行,再编译就不会报错了