Xcode 10.2在 iOS < 10的 Simulator 上运行应用程序失败

自从更新以来,我一直在玩 Xcode 10.2,当我试图在任何 iOS 版本小于10的模拟器上运行我的应用程序时,模拟器不会启动并崩溃,然后显示下面的错误:

Dyld: 库未加载:/usr/lib/libauto.dylib 引自: /系统/库/框架/Foundation.Framework/版本/C/Foundation 原因: 没有找到合适的图像: Mach-o,但不是为 iOS 模拟器而设计的

我尝试创建另一个全新的项目,没有触及任何东西,将部署目标设置为 iOS9,然后再次在 iOS9模拟器上运行,结果显示同样的错误。

更新

似乎这个问题只有在代码库包含迅速时才会发生。创建一个新的项目与目标 c 代码库没有崩溃的模拟器。是的。

总结

  1. Xcode 10.2包含无法在 iOS 9模拟器上运行应用程序的快速代码
  2. 我已经做了所有的清理和删除派生数据和问题仍然存在。

有人知道吗?

最终更新

苹果刚刚发布了 Xcode 10.2.1,这是模拟器已知问题的一部分,请参考下面的链接以获得解决方案/补丁:

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

感谢@Russbishop 的回复,接受回复

17097 次浏览

A rather annoying workaround: use Xcode 10.1 to deploy on 9.x simulators for now. It's the only way I've been able to get around this.

This is a known bug affecting iOS 8.x and 9.x. You can work around it by creating /usr/lib/swift directories in the relevant simulator runtime root.

Downloaded simulator runtimes are located in /Library/Developer/CoreSimulator/Profiles/Runtimes.

For example, to fix the iOS 9.3 simulator:

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

Me also got the same problem when run in iOS 9.0 simulator.

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

Simulators for iOS 9.3 and earlier might fail to launch Swift apps with the message: “dyld: Library not loaded: /usr/lib/libauto.dylib”. (49326587) Workaround: Run the following command in Terminal for the relevant version of iOS:

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

For this apple given above solution in that link.

Simply

--> open Terminal

--> Type this line with your required version (In my case i changed into iOS 9.3 to iOS 9.0)

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

--> Enter password

--> Now clean Xcode and run again

This above solution worked for me.

Updating to Xcode 10.3 has fixed it for me.

Still get this bug with Xcode 10.3. (Skipped over 10.2.)

This seems like an iOS Simulator bug. I see this happening on simulators with iOS 12.0 but not on those with 12.4.

None of the above worked for me. My issue is the same as this but was building an app for macOS.

Running Xcode 11 project target 10.4 whilst my OS is Mojave 10.4.6.

I had to install Xcode 10.3 and use that instead. No problems since.

My guess is its a problem with OS, Xcode version and project target.

Having to use Xcode 10.2.1 I had this issue with another library and ended up having to set always embed swift libraries to YES in build settings since the library in question was in a framework file I had.

I ran into this issue when I was doing unit-testing for iOS11 and iOS12.1 on Xcode11.1

The solution was to just run the unit-tests with an iOS13 simulator.