今是昨非

今是昨非

日出江花红胜火,春来江水绿如蓝

Add iOS 10.x simulator to Xcode 12.x.

Adding iOS 10.x Simulator to Xcode 12.x#

Background#

Yesterday, I encountered a problem where a user reported that a webpage was displaying a white screen on their iOS 10.3.1 device. However, I didn't have any 10.x version devices 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 supported downloading the iOS 10.3.1 simulator.

Steps#

Download iOS 10.3.1 Simulator#

After searching, I discovered that Xcode 12.4 still supported 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 the iOS 10.3.1 Simulator and downloaded it, as shown in the image below.

wecom20210715-161409.png

Add iOS 10.3.1 Simulator#

To add a simulator, select Xcode and go to Window -> Device and Simulators in the top menu. Select Simulators and click the "+" button in the bottom left corner to add a simulator, as shown in the image below.

screen shot 2021-07-15 at 16.19.20.png

You may notice that even after downloading the iOS 10.3.1 simulator, you still can't add it. Despite downloading it, you can't add it.

x5ltb.png

So I continued searching and finally found the only article that provided a solution: Running Lower Version iOS Simulators in Xcode 12. According to the article, the map file in the runtime version of the simulator's framework sets the upper limit of the corresponding macOS system for each version, which prevents adding the simulator.

The solution is to modify the CFBundleIdentifier in the simulator's Info.plist to bypass the map file.

The specific method is 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:

  1. Modifying the Plist can be done by copying it, making the changes, and then replacing the original.
  2. After modification, it is indeed possible to add the 10.3 simulator, and it can be operated normally on macOS 11.4.
  3. Even if the modification is successful and the simulator is added, it cannot be run on macOS 12.0 beta, also known as macOS Monterey.

Reference#

Running Lower Version iOS Simulators in Xcode 12

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.