分享

Installing and managing Simulator runtimes | Apple Developer Documentation

 wintelsui 2023-06-12 发布于北京

Overview

A Simulator runtime is an embedded OS package that Simulator loads when running your app on a simulated device in Xcode. For example, when you test your app on a simulated iPhone running iOS 17, Simulator loads the iOS 17 Simulator runtime on the simulated device.

To minimize download size, Xcode splits the Simulator runtimes for each platform into individual installs. This allows you to install only the Simulator runtimes specific to the platform you’re developing for. Xcode requires the current versions of Simulator runtimes to build projects and to run Simulator for those platforms.

If you download Xcode from the Apple Developer website, you can choose which Simulator runtimes to include. If you download Xcode from the Mac App Store, you can download and install these files when you first launch Xcode, or install them later from the Xcode run destination, from Xcode Settings, or from the command line.

Manage the amount of storage that Xcode requires by choosing Xcode > Settings > Platforms to view the currently installed Simulator runtimes, and remove any that you don’t need. You can reinstall or install additional Simulator runtimes at any time.

Install Simulator runtimes from the Apple Developer website

Starting with Xcode 15, you can select the platforms you want to download from the Apple Developer website.

Select the checkbox next to each platform you want to develop for, and then click the Download button. This initiates downloading Xcode, the selected platforms, and a manifest file to your Downloads folder. Don’t move the simulator and manifest files outside the Downloads folder during installation. When the selected simulator and manifest files finish downloading, Xcode automatically installs them from the Downloads folder.

Install Simulator runtimes during first launch

When you launch Xcode 14 or later for the first time, Xcode presents a dialog that indicates which Simulator runtimes are built-in, and which Simulator runtimes you may download. Select the checkbox next to a downloadable Simulator runtime, and then click Continue to download and install it. Xcode displays a status dialog while it downloads and installs the files for each platform you select.

You may create a new Xcode project or work with an existing Xcode project on a platform that Xcode is installing, but you may not run or build the project until Xcode finishes downloading and installing the files.

Install a Simulator runtime from the Xcode run destination

When you open an Xcode project for a platform that doesn’t have any installed Simulator runtimes, Xcode displays a Get button next to the run destination. Click the Get button to download and install the most current Simulator runtime for that platform.

The run destination in your Xcode project indicates when Xcode is downloading a Simulator runtime. You can select a run destination when the download and installation completes.

Install and manage Simulator runtimes in settings

Choose Xcode > Settings > Platforms to see a list of Simulator runtimes that are currently installed and available to download. Xcode shows the amount of storage you can recover if you remove an installed Simulator runtime, and displays Built-In for a Simulator runtime that Xcode requires.

To recover storage space from unused Simulator runtimes, select a Simulator runtime, click the Delete button (-) in the lower left corner, and click Delete in the confirmation dialog.

To install the current version of a Simulator runtime, click its Get button. For previous versions, click the Add button (+) in the lower left corner, and then select a platform to view a list of its available versions. Select a version, and click Download & Install. You can run projects on previous versions of the Simulator runtime, but you need to install the current version to build them.

Install and manage Simulator runtimes from the command line

Download the Simulator runtime you want to install from the Apple Developer website. Then follow these steps with the command line to install it:

  1. Select a version of Xcode.

  2. Run the first launch experience to install the required system components, including simctl.

  3. Install the Simulator runtime with simctl.

simctl verifies the signature of the downloaded Simulator runtime, and then installs it in a secure location on your computer.

For example:

    xcode-select -s /Applications/Xcode-beta.app
    xcodebuild -runFirstLaunch
    xcrun simctl runtime add "~/Downloads/watchOS 9 beta Simulator Runtime.dmg"

To download and install all the platforms that the Xcode version you selected supports, use the -downloadAllPlatforms option on xcodebuild.

    xcodebuild -downloadAllPlatforms

To download and install Simulator runtimes for a specific platform, use the -downloadPlatform option and specify the platform.

    xcodebuild -downloadPlatform iOS

See Also

Installing your app in many Simulator platforms and versions
Set up your app in multiple Simulator platforms and versions without the build-and-run cycle.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多