Version: 2022.3
iOS 构建设置
应用程序精简

Build for iOS

This page contains instructions on how to build your Unity application for iOS. For information on the build process for iOS and the tools Unity uses, see How Unity builds iOS applications.

At a high level, the iOS build process has two steps:

  1. Unity generates an Xcode project.
  2. Xcode builds the generated project into the application.

Unity can perform step one on all operating systems that run the Unity Editor. However, since you can only install Xcode on a macOS device, Unity can only perform step two on a macOS device. This means to fully build an iOS application locally, your development machine must run macOS. If it doesn’t, one alternative is to use Unity Cloud Build which can build your applications for you in the cloud. This makes it possible to develop iOS applications on a non-macOS machine. For information on how to set up Unity Cloud Build, see Unity Cloud Build.

Build your application from the Editor

To build your Unity application for iOS:

  1. Select File > Build Settings.
  2. From the list of platforms in the Platform panel, select iOS.
    Note: If iOS is greyed out, set up your project for iOS development.
  3. Click either Build or Build and Run.
  4. Select the destination for Unity to place the Xcode project. If you selected Build and Run and use a macOS device, Xcode builds the generated project into the application and installs the application on the iOS device connected to your computer.
  5. Click Save. If an Xcode project already exists in the target directory, Unity displays an alert and gives you a choice on how to proceed. For information on the options available, see .

Tip: After you specify the output path the first time, you can use the Cmd+B keyboard shortcut to build and run the application. Unity uses the Append mode to regenerate the Xcode project.

Build a Unity Xcode project from the command line

After Unity generates the Xcode project, you can build and run the application from the command line. To do this:

  1. Open the terminal and navigate to the Xcode project directory.
  2. Find the device ID of the device you want to run the application on. You can find this in Xcode under Window > Devices and Simulators.
  3. Enter the following command into the terminal where <device-id>is your device ID.
    unity$ xcodebuild test -destination "platform=iOS,id=<device-id>" -scheme Unity-iPhone.

其他资源

iOS 构建设置
应用程序精简
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961