Originally wanted to run the company’s project on iOS9 simulator to see the effect, under the simulator for a long time finally download good, happy to run, results directly crash…

Content of the error

dyld_sim`dyld_fatal_error:
    0x106bb6000 <+0>: int3   
->  0x106bb6001 <+1>: nop  
Copy the code
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
(lldb) 
Copy the code

Xcode10.2 + iOS9.3 before this issue

The experiment

As shown in the picture, the mood to pull cool pull cool Or2, then under iOS10.1 try to run it, everything is OK.

Later, I did an experiment to create a pure OC and pure Swift test project, and conducted the following tests

type Run the result on the simulator
Pure OC All the above works in iOS9
Pure Swift IOS9 fails, iOS10 succeeds
OC and Swift IOS9 fails, iOS10 succeeds

Conclusion: it appears that any Swift code included will fail on the iOS9 emulator, while there is no problem on the iOS9 real machine.

The solution

Open the terminal and run this command. In this command, iOS 9.1.simruntime needs to be modified according to its own situation

sudo mkdir '/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.1.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift'
Copy the code

Source: Xcode_10_2_1_RELEase_notes