System/Library/Frameworks/Foundation.framework/Versions/C/Foundation

使用Xcode10.2.1、模拟器9.0版本,运行Swift项目报如下错误

Referenced from: 
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation   
Reason: no suitable image found.  
Did find:   /usr/lib/libauto.dylib: mach-o, but not built for iOS simulator

从报错的字面意思能大致知道错误信息;搜索该错误信息,得到解决方法

亲测可行,做下记录


出错原因:

iOS 9.3及更早版本的模拟器可能无法启动带有“dyld: Library not loaded: /usr/lib/libauto.dylib”消息的Swift应用程序。Xcode10.2没有9.3以前的libauto.dylib这个系统库,模拟器运行时需要添加这个库。

解决方法:

在终端运行以下命令,对应iOS版本:

sudo mkdir '/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 模拟器版本.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift'

示例:

sudo mkdir '/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.0.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift'

官方文档链接:

https://developer.apple.com/documentation/xcode_release_notes/xcode_10_2_1_release_notes

你可能感兴趣的:(System/Library/Frameworks/Foundation.framework/Versions/C/Foundation)