Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Exporting for iOS

Viz také

This page describes how to export a Godot project to iOS. If you're looking to compile export template binaries from source instead, read Compiling for iOS.

These are the steps to load a Godot project in Xcode. This allows you to build and deploy to an iOS device, build a release for the App Store, and do everything else you can normally do with Xcode.

Výstraha

Projects written in C# can be exported to iOS as of Godot 4.2, but support is experimental and some limitations apply.

Requirements

  • You must export for iOS from a computer running macOS with Xcode installed.

  • Download the Godot export templates. Use the Godot menu: Editor > Manage Export Templates

Export a Godot project to Xcode

In the Godot editor, open the Export window from the Project menu. When the Export window opens, click Add.. and select iOS.

The App Store Team ID and (Bundle) Identifier options in the Application category are required. Leaving them blank will cause the exporter to throw an error.

Poznámka

If you encounter an error during export similar to
JSON text did not start with array or object and option to allow fragments not set
then it might be due to a malformated App Store Team ID!
The exporter expects a (10 characters long) code like ABCDE12XYZ and not, e.g., your name as Xcode likes to display in the Signing & Capabilities tab.
You can find the code over at developer.apple.com next to your name in the top right corner.

After you click Export Project, there are still two important options left:

  • Path is an empty folder that will contain the exported Xcode project files.

  • File will be the name of the Xcode project and several project specific files and directories.

../../_images/ios_export_file.png

Poznámka

This tutorial uses exported_xcode_project_name, but you will use your project's name. When you see exported_xcode_project_name in the following steps, replace it with the name you used instead.

Poznámka

Avoid using spaces when you choose your exported_xcode_project_name as this can lead to corruption in your XCode project file.

When the export completes, the output folder should look like this:

../../_images/ios_export_output.png

Opening exported_xcode_project_name.xcodeproj lets you build and deploy like any other iOS app.

Active development considerations

The above method creates an exported project that you can build for release, but you have to re-export every time you make a change in Godot.

While developing, you can speed this process up by linking your Godot project files directly into your app.

In the following example:

  • exported_xcode_project_name is the name of the exported iOS application (as above).

  • godot_project_to_export is the name of the Godot project.

Poznámka

godot_project_to_export must not be the same as exported_xcode_project_name to prevent signing issues in Xcode.

Zásuvné moduly pro iOS

Special iOS plugins can be used in Godot. Check out the Zásuvné moduly pro iOS page.

Environment variables

You can use the following environment variables to set export options outside of the editor. During the export process, these override the values that you set in the export menu.

iOS export environment variables

Export option

Environment variable

Encryption / Encryption Key

GODOT_SCRIPT_ENCRYPTION_KEY

Options / Application / Provisioning Profile UUID Debug

GODOT_IOS_PROVISIONING_PROFILE_UUID_DEBUG

Options / Application / Provisioning Profile UUID Release

GODOT_IOS_PROVISIONING_PROFILE_UUID_RELEASE