exporting_for_ios.rst 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. .. _doc_exporting_for_ios:
  2. Exporting for iOS
  3. =================
  4. .. seealso::
  5. This page describes how to export a Godot project to iOS.
  6. If you're looking to compile export template binaries from source instead,
  7. read :ref:`doc_compiling_for_ios`.
  8. These are the steps to load a Godot project in Xcode. This allows you to
  9. build and deploy to an iOS device, build a release for the App Store, and
  10. do everything else you can normally do with Xcode.
  11. Requirements
  12. ------------
  13. - You must export for iOS from a computer running macOS with Xcode installed.
  14. - Download the Godot export templates. Use the Godot menu: Editor > Manage Export Templates
  15. Export a Godot project to Xcode
  16. -------------------------------
  17. In the Godot editor, open the **Export** window from the **Project** menu. When the
  18. Export window opens, click **Add..** and select **iOS**.
  19. The **App Store Team ID** and (Bundle) **Identifier** options in the **Application** category
  20. are required. Leaving them blank will cause the exporter to throw an error.
  21. .. note:: | If you encounter an error during export similar to
  22. | ``JSON text did not start with array or object and option to allow fragments not set``
  23. | then it might be due to a malformated **App Store Team ID**!
  24. | 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.
  25. | You can find the code over at `developer.apple.com <https://developer.apple.com/account/resources/certificates/list>`_ next to your name in the top right corner.
  26. After you click **Export Project**, there are still two important options left:
  27. * **Path** is an empty folder that will contain the exported Xcode project files.
  28. * **File** will be the name of the Xcode project and several project specific files and directories.
  29. .. image:: img/ios_export_file.png
  30. .. note:: This tutorial uses **exported_xcode_project_name**, but you will use your
  31. project's name. When you see **exported_xcode_project_name**
  32. in the following steps, replace it with the name you used instead.
  33. .. note:: Avoid using spaces when you choose your **exported_xcode_project_name** as
  34. this can lead to corruption in your XCode project file.
  35. When the export completes, the output folder should look like this:
  36. .. image:: img/ios_export_output.png
  37. Opening **exported_xcode_project_name.xcodeproj** lets you build and deploy
  38. like any other iOS app.
  39. Active development considerations
  40. ---------------------------------
  41. The above method creates an exported project that you can build for
  42. release, but you have to re-export every time you make a change in Godot.
  43. While developing, you can speed this process up by linking your
  44. Godot project files directly into your app.
  45. In the following example:
  46. * **exported_xcode_project_name** is the name of the exported iOS application (as above).
  47. * **godot_project_to_export** is the name of the Godot project.
  48. .. note:: **godot_project_to_export** must not be the same as **exported_xcode_project_name**
  49. to prevent signing issues in Xcode.
  50. Steps to link a Godot project folder to Xcode
  51. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  52. 1. Start from an exported iOS project (follow the steps above).
  53. 2. In Finder, drag the Godot project folder into the Xcode file browser.
  54. .. image:: img/ios_export_add_dir.png
  55. 3. In the dialog, make sure **Create folder references** is selected. This means
  56. you will be able to continue to edit your Godot project in its current location.
  57. .. image:: img/ios_export_file_ref.png
  58. 4. See the **godot_project_to_export** folder in the Xcode file browser.
  59. 5. Delete **exported_xcode_project_name.pck** from the Xcode project.
  60. .. image:: img/ios_export_delete_pck.png
  61. 6. Open **exported_xcode_project_name-Info.plist** and add a string property named
  62. **godot_path** (this is the real key name) with a value **godot_project_to_export**
  63. (this is the name of your project)
  64. .. image:: img/ios_export_set_path.png
  65. That's it! You can now edit your project in the Godot editor and build it
  66. in Xcode when you want to run it on a device.
  67. Plugins for iOS
  68. ---------------
  69. Special iOS plugins can be used in Godot. Check out the
  70. :ref:`doc_plugins_for_ios` page.
  71. Environment variables
  72. ---------------------
  73. You can use the following environment variables to set export options outside of
  74. the editor. During the export process, these override the values that you set in
  75. the export menu.
  76. .. list-table:: iOS export environment variables
  77. :header-rows: 1
  78. * - Export option
  79. - Environment variable
  80. * - Encryption / Encryption Key
  81. - GODOT_SCRIPT_ENCRYPTION_KEY
  82. * - Options / Application / Provisioning Profile UUID Debug
  83. - GODOT_IOS_PROVISIONING_PROFILE_UUID_DEBUG
  84. * - Options / Application / Provisioning Profile UUID Release
  85. - GODOT_IOS_PROVISIONING_PROFILE_UUID_RELEASE