text
stringlengths
1
372
7.2
now 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.3
press 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.1
open 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,
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.2
from 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.