Skip to content

Update iOS App Clip instructions for Xcode 15 and iOS 16 #10145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 21 additions & 31 deletions src/platform-integration/ios/ios-app-clip.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
title: Adding an iOS App Clip target
description: How to add an iOS 14 App Clip target to your Flutter project.
description: How to add an iOS App Clip target to your Flutter project.
---

{{site.alert.important}}
This experimental preview currently exceeds the 10MB
uncompressed IPA payload size limit and cannot be
used in production ([#71098][]).
Targeting iOS 16 increases the uncompressed IPA payload size limit
to 15MB. Depending on the size of your app, you might hit the limit. ([#71098][]).
{{site.alert.end}}

This guide describes how to manually add another
Expand Down Expand Up @@ -55,8 +54,6 @@ Enter your new target detail in the dialog.

Select **Storyboard** for Interface.

Select **UIKit App Delegate** for Life Cycle.

Select the same language as your original target for **Language**.

(In other words, to simplify the setup,
Expand All @@ -74,6 +71,14 @@ activate the new scheme for the new target.
{% include docs/app-figure.md
image="development/platform-integration/ios-app-clip/activate-scheme.png" %}

**2.5**

Back in the project settings, open the **Build Phases** tab.
Drag **Embedded App Clips** to above **Thin Binary**.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This avoids an error when you build.


{% include docs/app-figure.md
image="development/platform-integration/ios-app-clip/embedded-app-clips.png" %}

<a id="step-3"></a>
## Step 3 - Remove unneeded files

Expand Down Expand Up @@ -129,6 +134,9 @@ normal app target.
This gives your App Clip target access to Flutter's
required build settings.

Set **iOS Deployment Target** to at least **16.0** to take advantage of the
15MB size limit.

{% include docs/app-figure.md
image="development/platform-integration/ios-app-clip/configuration.png" %}

Expand Down Expand Up @@ -223,22 +231,6 @@ These steps are not necessary for add-to-app.

**7.1**

In your App Clip's target's project settings,
open the **Build Settings** tab.

For setting `Framework Search Paths`, add 2 entries:

* `$(inherited)`
* `$(PROJECT_DIR)/Flutter`

In other words, the same as the main app target's build settings.

{% include docs/app-figure.md
image="development/platform-integration/ios-app-clip/app-clip-framework-search.png"
%}

**7.2**

For the Swift target,
set the `Objective-C Bridging Header`
build setting to `Runner/Runner-Bridging-Header.h`
Expand All @@ -250,7 +242,7 @@ the same as the main app target's build settings.
image="development/platform-integration/ios-app-clip/bridge-header.png"
%}

**7.3**
**7.2**

Now open the **Build Phases** tab. Press the **+** sign
and select **New Run Script Phase**.
Expand All @@ -267,6 +259,8 @@ Expand the new phase and add this line to the script content:
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build
```

Uncheck **Based on dependency analysis**.

In other words,
the same as the main app target's build phases.

Expand All @@ -277,7 +271,7 @@ image="development/platform-integration/ios-app-clip/xcode-backend-build.png"
This ensures that your Flutter Dart code is compiled
when running the App Clip target.

**7.4**
**7.3**

Press the **+** sign and select **New Run Script Phase** again.
Leave it as the last phase.
Expand All @@ -288,6 +282,8 @@ This time, add:
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed_and_thin
```

Uncheck **Based on dependency analysis**.

In other words,
the same as the main app target's build phases.

Expand All @@ -300,11 +296,6 @@ into the App Clip bundle.

## Step 8 - Integrate plugins

{{site.alert.warning}}
CocoaPods version 1.10.0.beta.1 or higher is required
to run Flutter apps with plugins.
{{site.alert.end}}

**8.1**

Open the `Podfile` for your Flutter project
Expand Down Expand Up @@ -372,7 +363,7 @@ pod install

You can now run your App Clip target from Xcode by
selecting your App Clip target from the scheme drop-down,
selecting an iOS 14 device and pressing run.
selecting an iOS 16 or higher device and pressing run.

{% include docs/app-figure.md
image="development/platform-integration/ios-app-clip/run-select.png"
Expand All @@ -393,7 +384,6 @@ networking permission restrictions.
In order to debug your App Clip and use functionalities
like hot reload, you must look for the Observatory URI
from the console output in Xcode after running.
[PENDING: Is this still true?]

{% include docs/app-figure.md
image="development/platform-integration/ios-app-clip/observatory-uri.png"
Expand Down