text
stringlengths
1
474
drop in the desired images to the LaunchImage image set.Apple provides detailed guidance for launch screens as
part of the Human Interface Guidelines.
<topic_end>
<topic_start>Adding an iOS App Clip target
error Important
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).This guide describes how to manually add another
Flutter-rendering iOS App Clip target to your
existing Flutter project or add-to-app project.warning Warning
This is an advanced guide and is best intended
for audience with a working knowledge of iOS development.To see a working sample, see the App Clip sample on GitHub.<topic_end>
<topic_start>
Step 1 - Open project
Open your iOS Xcode project, such as
ios/Runner.xcworkspace for full-Flutter apps.<topic_end>
<topic_start>
Step 2 - Add an App Clip target
2.1Click on your project in the Project Navigator to show
the project settings.Press + at the bottom of the target list to add a new target.2.2Select the App Clip type for your new target.2.3Enter your new target detail in the dialog.Select Storyboard for Interface.Select the same language as your original target for Language.(In other words, to simplify the setup,
don’t create a Swift App Clip target for
an Objective-C main target, and vice versa.)2.4In the following dialog,
activate the new scheme for the new target.2.5Back in the project settings, open the Build Phases tab.
Drag Embedded App Clips to above Thin Binary.<topic_end>
<topic_start>
Step 3 - Remove unneeded files
3.1In the Project Navigator, in the newly created App Clip group,
delete everything except Info.plist and
<app clip target>.entitlements.lightbulb Tip
For add-to-app users, it’s up to the reader to decide
how much of this template to keep to invoke
FlutterViewController or FlutterEngine APIs
from this code later.Move files to trash.3.2If you don’t use the SceneDelegate.swift file,
remove the reference to it in the Info.plist.Open the Info.plist file in the App Clip group.
Delete the entire dictionary entry for
Application Scene Manifest.<topic_end>
<topic_start>
Step 4 - Share build configurations
This step isn’t necessary for add-to-app projects
since add-to-app projects have their custom build
configurations and versions.4.1Back in the project settings,
select the project entry now rather than any targets.In the Info tab, under the Configurations
expandable group, expand the
Debug, Profile, and Release entries.For each, select the same value from the drop-down menu
for the App Clip target as the entry selected for the
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.4.2In the App Clip group’s Info.plist file, set:<topic_end>
<topic_start>
Step 5 - Share code and assets
<topic_end>
<topic_start>
Option 1 - Share everything
Assuming the intent is to show the same Flutter UI
in the standard app as in the App Clip,
share the same code and assets.For each of the following: Main.storyboard, Assets.xcassets,
LaunchScreen.storyboard, GeneratedPluginRegistrant.m, and
AppDelegate.swift (and Supporting Files/main.m if using Objective-C),
select the file, then in the first tab of the inspector,
also include the App Clip target in the Target Membership
checkbox group.<topic_end>
<topic_start>
Option 2 - Customize Flutter launch for App Clip
In this case,
do not delete everything listed in Step 3.
Instead, use the scaffolding and the iOS add-to-app APIs
to perform a custom launch of Flutter.
For example to show a custom Flutter route.<topic_end>
<topic_start>
Step 6 - Add App Clip associated domains
This is a standard step for App Clip development.
See the official Apple documentation.6.1Open the <app clip target>.entitlements file.
Add an Associated Domains Array type.
Add a row to the array with appclips:<your bundle id>.6.2The same associated domains entitlement needs to be added
to your main app, as well.Copy the <app clip target>.entitlements file from your
App Clip group to your main app group and rename it to
the same name as your main target
such as Runner.entitlements.Open the file and delete the
Parent Application Identifiers
entry for the main app’s entitlement file
(leave that entry for the App Clip’s entitlement file).6.3Back in the project settings, select the main app’s target,
open the Build Settings tab.
Set the Code Signing Entitlements setting to the
relative path of the second entitlements file
created for the main app.<topic_end>
<topic_start>
Step 7 - Integrate Flutter
These steps are not necessary for add-to-app.7.1For the Swift target,
set the Objective-C Bridging Header
build setting to Runner/Runner-Bridging-Header.hIn other words,
the same as the main app target’s build settings.7.2Now open the Build Phases tab. Press the + sign
and select New Run Script Phase.Drag that new phase to below the Dependencies phase.Expand the new phase and add this line to the script content:Uncheck Based on dependency analysis.In other words,
the same as the main app target’s build phases.This ensures that your Flutter Dart code is compiled
when running the App Clip target.7.3Press the + sign and select New Run Script Phase again.
Leave it as the last phase.This time, add:Uncheck Based on dependency analysis.In other words,
the same as the main app target’s build phases.This ensures that your Flutter app and engine are embedded
into the App Clip bundle.<topic_end>
<topic_start>
Step 8 - Integrate plugins
8.1Open the Podfile for your Flutter project
or add-to-app host project.For full-Flutter apps, replace the following section:with:At the top of the file,