text
stringlengths
1
474
also uncomment platform :ios, '12.0' and set the
version to the lowest of the two target’s iOS
Deployment Target.For add-to-app, add to:with:8.2From the command line,
enter your Flutter project directory
and then install the pod:<topic_end>
<topic_start>
Run
You can now run your App Clip target from Xcode by
selecting your App Clip target from the scheme drop-down,
selecting an iOS 16 or higher device and pressing run.To test launching an App Clip from the beginning,
also consult Apple’s doc on
Testing Your App Clip’s Launch Experience.<topic_end>
<topic_start>
Debugging, hot reload
Unfortunately flutter attach cannot auto-discover
the Flutter session in an App Clip due to
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.You must then copy and paste it back into the
flutter attach command to connect.For example:
<topic_end>
<topic_start>Adding iOS app extensions
iOS app extensions allow you to expand functionality
outside your app. Your app could appear as a home screen widget,
or you can make portions of your app available within other apps.To learn more about app extensions, check out
Apple’s documentation.info Note
If you experience a build error when building an
iOS app that includes an app extension, be
aware that there is an open bug. The workaround
involves changing the order of the build process.
For more information, check out
Issue #9690 and Issue #135056.<topic_end>
<topic_start>
How do you add an app extension to your Flutter app?
To add an app extension to your Flutter app,
add the extension point target to your Xcode project.In Xcode, select File -> New -> Target from the menu bar.To learn how to add a home screen widget to your iOS device,
check out the
Adding a Home Screen Widget to your Flutter app
codelab.<topic_end>
<topic_start>
How do Flutter apps interact with App Extensions?
Flutter apps interact with app extensions using the same
techniques as UIKit or SwiftUI apps.
The containing app and the app extension don’t communicate directly.
The containing app might not be running while the device user
interacts with the extension.
The app and your extension can read and write to
shared resources or use higher-level APIs
to communicate with each other.<topic_end>
<topic_start>
Using higher-level APIs
Some extensions have APIs. For example,
the Core Spotlight framework indexes your app,
allowing users to search from Spotlight and Safari.
The WidgetKit framework can trigger an update
of your home screen widget.To simplify how your app communicates with extensions,
Flutter plugins wrap these APIs.
To find plugins that wrap extension APIs,
check out Leveraging Apple’s System APIs and Frameworks
or search pub.dev.<topic_end>
<topic_start>
Sharing resources
To share resources between your Flutter app
and your app extension, put the Runner app target
and the extension target in the same App Group.info Note
You must be signed in to your Apple Developer account.To add a target to an App Group:Choose which App Group you want to add the target from
one of two options:When two targets belong to the same App Group,
they can read from and write to the same source.
Choose one of the following sources for your data.<topic_end>
<topic_start>
Background updates
Background tasks provide a means to update your extension
through code regardless of the status of your app.To schedule background work from your Flutter app,
use the workmanager plugin.<topic_end>
<topic_start>
Deep linking
You might want to direct users from an
app extension to a specific page in your Flutter app.
To open a specific route in your app,
you can use Deep Linking.<topic_end>
<topic_start>
Creating app extension UIs with Flutter
Some app extensions display a user interface.For example, share extensions allow users to conveniently
share content with other apps,
such as sharing a picture to create
a new post on a social media app.As of the 3.16 release, you can build
Flutter UI for an app extension,
though you must use an extension-safe
Flutter.xcframework and embed the
FlutterViewController as described in
the following section.info Note
Due to the memory limitations of app extensions,
use Flutter to build an app extension UI for extension
types that have memory limits larger than 100MB.
For example, Share extensions have a 120MB memory limit.In addition, Flutter uses extra memory in debug mode.
Therefore, Flutter doesn’t fully support running
app extensions in debug mode on physical devices
when used to build extension UI; it might run out of memory.
As an alternative,
use an iOS simulator to test your extension in debug mode.Locate the extension-safe Flutter.xcframework file,