Xcode 10.2 Failed to Run App on Simulator with iOS < 10
Asked Answered
S

9

77

I was playing around with Xcode 10.2 since the update and when I try to run my app on ANY simulator with iOS version less than 10, the simulator will not start and crash then show the error below:

dyld: Library not loaded: /usr/lib/libauto.dylib 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

I tried to create another new project fresh without touching anything, set the deployment target to iOS 9 and run on iOS 9 simulator again, same error was shown.

UPDATE

It seems like this issue only occur when your code base contain swift. Created a new project with objective c code base did not crash the simulator. For swift yes.

SUMMARY

  1. Xcode 10.2 contain swift code unable to run app on simulator with iOS 9
  2. I have done all the cleaning and delete derive data and the issue still persist.

Anyone has any idea ?

FINAL UPDATE

Apple just release Xcode 10.2.1 and it is part of the known issue for simulator, please refer to the link below for the workaround/fix:

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

Appreciate @russbishop 's reply, answer accepted

Skvorak answered 28/3, 2019 at 1:58 Comment(4)
I have exactly the same problem, same Xcode version. Tried cleaning / reinstalling. Even tried some magic with provisioning profile / certificates. Still does not work.Butanone
Does this bug only apply to simulator, or will it also break on an iOS 9.3 device?Kronfeld
It worked with real device 9.3.5. But not work with the simulator.Cuenca
Very good report, thanks for staying with this thru to the resolution.Rooftree
A
110

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'
Ausgleich answered 16/4, 2019 at 17:28 Comment(2)
Before running mkdir, make sure that the 'iOS 9.3.simruntime' does not exists already. For me, the '.../RuntimeRoot/usr/lib/swift' was missing the 'swift' folder. Simply navigating to '/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.3.simruntime/Contents/Resources/RuntimeRoot/usr/lib' and creating a dir for 'swift' fix it.Function
I've tried countless solutions and only this one worked. Thank you very much!Breakfront
W
13

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.

Widthwise answered 18/4, 2019 at 11:8 Comment(0)
T
8

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

Tiffin answered 7/8, 2019 at 9:8 Comment(1)
This saved my sanity!! Yes, it seems to be a simulator 12.0 bug only.Nanettenani
M
5

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

Mannequin answered 28/7, 2019 at 16:50 Comment(1)
It's not Swift 10.3Widthwise
C
4

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.

Cornelius answered 30/1, 2020 at 19:14 Comment(0)
S
2

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.

Stasny answered 29/3, 2019 at 20:21 Comment(3)
won't work if anyone's project is ported to swift 5.Lorenelorens
Yeah great point. Just refer to the top answer and the official work around: sudo mkdir '/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.3.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift'Stasny
"No such file or directory"Samul
R
2

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.

Rauwolfia answered 4/10, 2019 at 12:5 Comment(1)
Yep, worth noting that Xcode 11 + Catalina does not longer support iOS9.x simulators.Stasny
T
0

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.

Taritariff answered 12/12, 2019 at 16:0 Comment(0)
A
-1

Updating to Xcode 10.3 has fixed it for me.

Anserine answered 23/7, 2019 at 14:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.