Mobile Game 45 · Export the iOS game and try TestFlight

Museum of Lost Lights · Lesson 45 of 50 · Publishing · About 45 min

An iPhone tester wants to visit the museum. First prepare a bundle identity, then make sure the game, signing details and App Store record refer to the same app.

A gouache painting of a Space Gallery with celestial exhibits, a midnight-blue floor and a domed ceiling.
What you’ll make Understand the steps from a Godot project to an Xcode archive and a TestFlight beta.

Download the projects from the course page. In Godot’s Project Manager, choose Import, select project.godot, and use Run Project (F5). Start from checkpoints/44 when the lesson builds on prior work, or copy the checkpoints/45 folder to try this lesson on its own. Read the file names in the steps before editing.

Keep one identity. Godot, Xcode and App Store Connect agree on the bundle ID. → Export into Xcode. Godot makes the iOS project files. → Archive and upload. Xcode prepares the signed distribution build. → Try TestFlight. Testers play the chosen beta build.
Keep one identity → Export into Xcode → Archive and upload → Try TestFlight

Build it step by step

Language and tools in this lesson typed function parameters, String.strip_edges, String.is_empty, elif, early return, Apple team, bundle ID.

  1. Open the checkpoint in Godot

    Extract the course files. In Godot Project Manager, choose Import and point it to this lesson’s project.godot. Double-click main.gd in FileSystem to open the script. Press F6 to run the current scene once main.tscn is open, or F5 to run the project. The two buttons use fictional values. A real iOS export must be done on macOS with Xcode installed.

    const UI = preload("res://lesson_ui.gd")

    Why it works This small project lets you see one release skill at a time. The finished Museum of Lost Lights is a second, independent project. Keep both projects in their own folders.

  2. Match the fictional records

    In main.gd, follow the two button calls. Each sends a team value, the ID from the project, and the ID written on the pretend store record. Use the first button to see how a blank team is reported.

    if team.strip_edges().is_empty():

    Why it works Bundle IDs must match. A team ID is a value identifying the publisher’s Apple team. Sample strings in this project never authenticate or sign an app.

  3. Prepare the actual tools on a Mac

    Install the project’s matching Godot export templates and a supported Xcode. Run Xcode once to finish its setup. As checked in November 2026, Apple requires Xcode 26 or later and the iOS 26 SDK for current App Store uploads. Verify Apple’s requirements again before submission.

    Why it works The Xcode SDK version is used to compile the app. The deployment target is separately the oldest supported iOS release. In November 2026 Apple states iOS 13 or later as its App Store minimum; choose a compatible target for your Godot version and test devices.

  4. Export the Godot project into Xcode

    Use Godot Project → Export → Add → iOS. Enter the publishing team’s Team ID and your game’s unique Bundle Identifier as instructed by Godot, then export to a new empty folder. In Xcode, open the generated project, select the app target, verify Signing & Capabilities with the adult, and select the team.

    Why it works Godot prepares project files. Xcode builds and signs the iOS app using the publisher’s settings.

  5. Build and archive a device release

    Run a local build on a compatible device, then use the build destination suitable for archiving. In Xcode choose Product → Archive. In Organizer, choose the distribution flow for App Store Connect and upload the archive. The adult should have created the matching App Store Connect app record.

    Why it works The archive is the versioned package uploaded for App Store distribution and TestFlight. A simulator run is useful for layout, and testing on a real iPhone checks touch and performance.

  6. Invite TestFlight testers

    In App Store Connect, choose the app and open TestFlight after processing finishes. Select a build and add it to a testing group. Internal testers are selected App Store Connect users with access. For friends or other external testers, use the external testing setup and submit for TestFlight review when required.

    elif project_id != store_id:

    Why it works TestFlight gives testers pre-release builds and a way to send feedback. App Store review for release is a separate step.

  7. Read the result, then apply it to your game

    Make a simulated submission card if you have no Mac or adult-managed publishing account today. Mark iOS archive, TestFlight and actual device testing as future tasks. Keep screenshots of real credentials out of class work.

    Why it works The checkpoint shows what to look for. Your game’s real result comes from testing your own build, assets and settings.

Watch the values change

  1. Check the missing-team card The team value is blank.
    What you see. The first guard reports a missing team.
  2. Check the mismatch card The team example exists, but the IDs differ.
    What you see. The checker reports a bundle mismatch.
  3. Check the matched card The team exists and both IDs are equal.
    What you see. The example records match.

Predict before you run A made-up team string passes the local empty-string check. Does that mean Xcode can sign with it?

Reveal the answer

No. The checkpoint only knows whether the string contains characters. Xcode and Apple verify the account, certificate, provisioning and real team when building for distribution.

Complete checkpoint

Three practice buttons report a missing team, mismatch or successful local match. No real account information is required.

main.gd

extends Control

const UI = preload("res://lesson_ui.gd")
var result: Label

func _ready() -> void:
	var column := UI.build(self, "iOS release practice", "These pretend examples only compare strings.")
	UI.button(column, "Missing team", _check.bind("", "com.example.museum", "com.example.museum"))
	UI.button(column, "Mismatched bundle IDs", _check.bind("EXAMPLETEAM", "com.example.museum", "com.example.other"))
	UI.button(column, "Matching practice records", _check.bind("EXAMPLETEAM", "com.example.museum", "com.example.museum"))
	result = UI.message(column, "Choose a sample record.")

func _check(team: String, project_id: String, store_id: String) -> void:
	if team.strip_edges().is_empty():
		result.text = "Missing team. Choose the publishing team in the real signing settings."
	elif project_id != store_id:
		result.text = "Bundle IDs differ. Compare the Godot, Xcode and store records."
	else:
		result.text = "Example records match. A real archive still needs valid signing."

lesson_ui.gd

extends RefCounted

static func build(screen: Control, heading: String, opening: String) -> VBoxContainer:
	var margins := MarginContainer.new()
	screen.add_child(margins)
	margins.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
	for edge in ["left", "right", "top", "bottom"]:
		margins.add_theme_constant_override("margin_" + edge, 24)
	var scroll := ScrollContainer.new()
	margins.add_child(scroll)
	var column := VBoxContainer.new()
	column.size_flags_horizontal = Control.SIZE_EXPAND_FILL
	scroll.add_child(column)
	column.add_theme_constant_override("separation", 12)
	var title := Label.new()
	title.text = heading
	title.add_theme_font_size_override("font_size", 30)
	column.add_child(title)
	message(column, opening)
	return column

static func message(column: VBoxContainer, text: String) -> Label:
	var line := Label.new()
	line.text = text
	line.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
	column.add_child(line)
	return line

static func button(column: Container, caption: String, action: Callable) -> Button:
	var control := Button.new()
	control.text = caption
	control.custom_minimum_size.y = 48
	control.pressed.connect(action)
	column.add_child(control)
	return control

GDScript line by line

Follow the line numbers, including the indent at the start of each line. Find the code the game will run first, then look for the function that reacts when you tap or change something.

Read main.gd line by line
  1. extends ControlStarts with Godot's Control type. This script gets the abilities of that type and adds the game's own rules.
  2. const UI = preload("res://lesson_ui.gd")Creates a constant named UI. The expression prepares a resource at a fixed project path when the script is loaded.
  3. var result: LabelDeclares result for later use. A colon followed by a type says which kind of value belongs here.
  4. func _ready() -> void:Godot calls this once after the scene and its children are ready. Use it to set up the room and connect controls.
  5. var column := UI.build(self, "iOS release practice", "These pretend examples only compare strings.")Creates a variable named column. The expression calls UI.build with the values in its parentheses. Godot infers the type from the first value.
  6. UI.button(column, "Missing team", _check.bind("", "com.example.museum", "com.example.museum"))Calls UI.button with the values in its parentheses.
  7. UI.button(column, "Mismatched bundle IDs", _check.bind("EXAMPLETEAM", "com.example.museum", "com.example.other"))Calls UI.button with the values in its parentheses.
  8. UI.button(column, "Matching practice records", _check.bind("EXAMPLETEAM", "com.example.museum", "com.example.museum"))Calls UI.button with the values in its parentheses.
  9. result = UI.message(column, "Choose a sample record.")Stores the new value in result. The expression calls UI.message with the values in its parentheses.
  10. func _check(team: String, project_id: String, store_id: String) -> void:Defines check, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect.
  11. if team.strip_edges().is_empty():Checks team.strip_edges().is_empty(). The indented instructions below run only if this test passes.
  12. result.text = "Missing team. Choose the publishing team in the real signing settings."Updates result.text, which controls the words a player sees. The expression uses the text inside the quotes.
  13. elif project_id != store_id:If the earlier branches did not run, checks project_id != store_id next.
  14. result.text = "Bundle IDs differ. Compare the Godot, Xcode and store records."Updates result.text, which controls the words a player sees. The expression uses the text inside the quotes.
  15. else:Runs the indented fallback instructions if none of the earlier tests passed.
  16. result.text = "Example records match. A real archive still needs valid signing."Updates result.text, which controls the words a player sees. The expression uses the text inside the quotes.
Read lesson_ui.gd line by line
  1. extends RefCountedStarts with Godot's RefCounted type. This script gets the abilities of that type and adds the game's own rules.
  2. static func build(screen: Control, heading: String, opening: String) -> VBoxContainer:Defines build, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect.
  3. var margins := MarginContainer.new()Creates a variable named margins. The expression creates a new MarginContainer object. Godot infers the type from the first value.
  4. screen.add_child(margins)Adds the new node to the scene tree so that Godot can run and draw it.
  5. margins.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)Positions this Control relative to the bounds of its parent.
  6. for edge in ["left", "right", "top", "bottom"]:Repeats the indented instructions for each value in ["left", "right", "top", "bottom"].
  7. margins.add_theme_constant_override("margin_" + edge, 24)Calls margins.add_theme_constant_override with the values in its parentheses.
  8. var scroll := ScrollContainer.new()Creates a variable named scroll. The expression creates a new ScrollContainer object. Godot infers the type from the first value.
  9. margins.add_child(scroll)Adds the new node to the scene tree so that Godot can run and draw it.
  10. var column := VBoxContainer.new()Creates a variable named column. The expression creates a new VBoxContainer object. Godot infers the type from the first value.
  11. column.size_flags_horizontal = Control.SIZE_EXPAND_FILLStores the new value in column.size_flags_horizontal. The expression reads Control.SIZE_EXPAND_FILL.
  12. scroll.add_child(column)Adds the new node to the scene tree so that Godot can run and draw it.
  13. column.add_theme_constant_override("separation", 12)Calls column.add_theme_constant_override with the values in its parentheses.
  14. var title := Label.new()Creates a variable named title. The expression creates a new Label object. Godot infers the type from the first value.
  15. title.text = headingUpdates title.text, which controls the words a player sees. The expression reads heading.
  16. title.add_theme_font_size_override("font_size", 30)Calls title.add_theme_font_size_override with the values in its parentheses.
  17. column.add_child(title)Adds the new node to the scene tree so that Godot can run and draw it.
  18. message(column, opening)Calls message with the values in its parentheses.
  19. return columnFinishes the function and hands its result back to the caller. The expression reads column.
  20. static func message(column: VBoxContainer, text: String) -> Label:Defines message, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect.
  21. var line := Label.new()Creates a variable named line. The expression creates a new Label object. Godot infers the type from the first value.
  22. line.text = textUpdates line.text, which controls the words a player sees. The expression reads text.
  23. line.autowrap_mode = TextServer.AUTOWRAP_WORD_SMARTStores the new value in line.autowrap_mode. The expression reads TextServer.AUTOWRAP_WORD_SMART.
  24. column.add_child(line)Adds the new node to the scene tree so that Godot can run and draw it.
  25. return lineFinishes the function and hands its result back to the caller. The expression reads line.
  26. static func button(column: Container, caption: String, action: Callable) -> Button:Defines button, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect.
  27. var control := Button.new()Creates a variable named control. The expression creates a new Button object. Godot infers the type from the first value.
  28. control.text = captionUpdates control.text, which controls the words a player sees. The expression reads caption.
  29. control.custom_minimum_size.y = 48Stores the new value in control.custom_minimum_size.y. The expression uses the whole number 48.
  30. control.pressed.connect(action)Links a signal to the function that should run when the event happens.
  31. column.add_child(control)Adds the new node to the scene tree so that Godot can run and draw it.
  32. return controlFinishes the function and hands its result back to the caller. The expression reads control.

Find and fix a bug

If your actual upload cannot find the app, compare the full Xcode bundle identifier with the app record. A missing team or mismatched app ID needs to be fixed in your project and account, not in the checker.

Try a change

Ages 10–12: make three cards labelled Godot, Xcode and TestFlight and order them. Ages 13–16: add a missing-ID check and add a device test for leaving the game and returning during a puzzle.

Official instructions