Xcode 10.2 Failed to Run App on Simulator with iOS < 10
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
- Xcode 10.2 contain swift code unable to run app on simulator with iOS 9
- 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
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.
This seems like an iOS Simulator bug. I see this happening on simulators with iOS 12.0 but not on those with 12.4.
Still get this bug with Xcode 10.3. (Skipped over 10.2.)
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.