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

swiftui: mach-o, but not built for ios simulator
unable to boot the simulator
xcode 10.2 1 ios
xcode error: module importing failed: invalid pathname
dyld: library not loaded ios app
xcode 10.2 swift version
unable to run application on device dyld: library not loaded
xcode tests not running

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

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'

Xcode 10.2 Failed to Run App on Simulator with iOS < 10 - ios, 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  Xcode 10.2 Failed to Run App on Simulator with iOS < 10 1 objc[29733]: Swift class extensions and categories on Swift classes are not allowed to have +load methods xcode 10.2 running on ios 12.2

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.

dyld: Library not loaded: /usr/lib…, [ Run old project on simulator 9.3 in Xcode 10.2 ] https://stackoverflow.com/​questions/55389080/xcode-10-2-failed-to-run-app-on-simulator-with-ios-10. simulator-->services-->a reset content and settings, closing xcode and re-opening xcode --> developer toos --> simulator -->(open the simulator), quit simulator Activity monitor -->(the simulator is closed so nothing here to force close) First of all quit your simulator. And then quit and restart Xcode. And then run your project.

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

Unable to find iOS Simulators (Post Xcode 10.2 install) · Issue #2691 , Unable to find iOS Simulators (Post Xcode 10.2 install) #2691 After installing Xcode 10.2, Carthage fails to build any project due to Could not find Running any app that boots the simulator; xcrun simctl list devices --json  Run flutter plugin On iOS Simulator Failed [33m[!] [39m iOS toolchain - develop for iOS devices (Xcode 10.2.1) [32m• [39m Xcode at /Applications/Xcode.app

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

Unable to Run iOS Simulator - Help: Expo SDK, I recently updated my xCode version to 10.2 and whenever I run the with Expo (2.13), it tried to download Expo app on the simulator and fail : App asset catalogs built using Xcode 10 with a deployment target of iOS 9.0, 9.1 or 9.2 produced content incompatible with the runtimes of those iOS versions when distributed using local or enterprise distribution. Rebuilding the app with Xcode 10.2 resolves this issue. (46893768, 44535967) Image slicing mode is improved in Dark Mode. (39388416)

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.

How to update to Xcode 10.2.1 on High Sierra, If you don't have Xcode installed yet also download and install 10.1 (you can Navigate to Xcode 10.2.1.app/Contents/ and edit the file Info.plist, change the to Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/ edit now i can debug from IMAC 2010 with Xcode 10.3 a iPhone 7 device with iOS 13.2.2. WARNING ITMS-90725: "SDK Version Issue. This app was built with the iOS 12.2 SDK. Starting April 2020, all iOS apps submitted to the App Store must be built with the iOS 13 SDK or later, included in Xcode 11 or later."

Xcode Tips - How to Reset Xcode and the iOS Simulator, The root cause of the issue is that Xcode / the iOS Simulator has issues in This included Virtual Machines (which is how your builds are running on bitrise.io), being skipped - UI Testing Failure - App state for <XCUIApplicationProcess: …>  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 ?

List of known Xcode issues, Well, call me dumb, but I wanted to try Xcode 11 Beta. for Mac (8.0.9 build 5) is no longer able to start my Xamarin Forms app in an iOS simulator. selector sent to instance 0x7fd2b9131710 Failed to launch the simulator: (it's pointing to Xcode 10.2.1) and the command line tools in Xcode (10.2.1). Xcode Tips How to Reset Xcode and the iOS Simulator Sometimes your app fails to launch because of Xcode bugs or errors. Delete Old Simulators in Xcode 10.2 (#3 – Run the app in a

Debugging iOS is broken after installation of Xcode 11 Beta , Access Xcode device logs to help diagnose app installation and code issues. Integrate the SDK · Connect to the Apple Developer Portal · Upload your iOS certificates if you run Xcode and connect your device after an installation failure​, none of the installation Select Device and Simulators from the Window menu. Firstly, (and to show you what’s happening here) go to your Titanium application project folder in Terminal, and type appc run -p ios --ios-version 1 — you’re told (correctly) that “1” is invalid and asked to select an SDK version — if you have Xcode 9 installed, you’ll see 11.4 and with Xcode 10, you’ll see 12.

Comments
  • I have exactly the same problem, same Xcode version. Tried cleaning / reinstalling. Even tried some magic with provisioning profile / certificates. Still does not work.
  • Does this bug only apply to simulator, or will it also break on an iOS 9.3 device?
  • It worked with real device 9.3.5. But not work with the simulator.
  • Very good report, thanks for staying with this thru to the resolution.
  • 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.
  • I've tried countless solutions and only this one worked. Thank you very much!
  • This saved my sanity!! Yes, it seems to be a simulator 12.0 bug only.
  • It's not Swift 10.3
  • won't work if anyone's project is ported to swift 5.
  • 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'
  • "No such file or directory"
  • Yep, worth noting that Xcode 11 + Catalina does not longer support iOS9.x simulators.