Adding iOS 10.x Simulator to Xcode 12.x#
Yesterday, I encountered a problem where a webpage would display a white screen on an iOS 10.3.1 device. However, I didn't have a 10.x version device on hand, so I wanted to install a simulator to try to reproduce the issue.
However, I found that the Xcode version on my computer was 12.5.1, which no longer supports downloading the iOS 10.3.1 simulator.
Download iOS 10.3.1 Simulator#
After searching, I found that Xcode 12.4 still supports downloading the iOS 10.3.1 simulator. So I went to the Xcode download website, downloaded Xcode 12.4, and then opened Xcode preferences with
CMD + ,. In the Components tab, I found and downloaded the iOS 10.3.1 Simulator, as shown in the following image.
Add iOS 10.3.1 Simulator#
To add a simulator, select Xcode, go to the top menu, choose Window -> Device and Simulators, select Simulators, and click the "+" button in the bottom left corner to add a simulator, as shown in the following image.
You may notice that even after downloading the iOS 10.3.1 simulator, you still can't add it. You downloaded it, but you can't add it.
So I continued to search and finally came across the only article that tells the truth, Running Lower Version iOS Simulators in Xcode 12. According to the article, the map file in the runtime version framework of the simulator sets the upper limit of the corresponding Mac OS system for each version, which prevents it from being added.
The solution is to modify the CFBundleIdentifier in the simulator's Info.plist to bypass the map file.
The specific method is very simple. Close the simulator and Xcode. For example, if I want to force the execution of the 10.3 simulator, I edit /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 10.3.simruntime/Contents/Info.plist and change CFBundleIdentifier from com.apple.CoreSimulator.SimRuntime.iOS-10-3 to com.apple.CoreSimulator.SimRuntime.iOS-10-3-1. By adding a -1 at the end, the function that checks the version restriction cannot find the bundle name, and then you can open Xcode and add it!
My practical experience:
- Modifying the Plist can be done by copying it out, making the changes, and then copying it back to replace the original.
- After modification, the 10.3 simulator can indeed be added and operated normally on macOS 11.4.
- Even if the modification is successful and the 10.3 simulator is added, it cannot be run on macOS 12.0 beta, also known as macOS Monterey.