text stringlengths 1 372 |
|---|
you should now be able to build the project in xcode using ⌘b. |
<topic_end> |
<topic_start> |
option c - embed application and plugin frameworks in xcode and flutter framework with CocoaPods |
alternatively, instead of distributing the large flutter.xcframework |
to other developers, machines, or continuous integration systems, |
you can instead generate flutter as CocoaPods podspec by adding |
the flag --cocoapods. this produces a flutter.podspec |
instead of an engine flutter.xcframework. |
the app.xcframework and plugin frameworks are generated |
as described in option b. |
to generate the flutter.podspec and frameworks, run the following |
from the command line in the root of your flutter module: |
host apps using CocoaPods can add flutter to their podfile: |
<code_start> |
pod 'flutter', :podspec => 'some/path/myapp/flutter/[build mode]/Flutter.podspec' |
<code_end> |
info note |
you must hard code the [build mode] value. |
for example, use debug if you need to use |
flutter attach and release when you’re ready to ship. |
link and embed the generated app.xcframework, |
FlutterPluginRegistrant.xcframework, |
and any plugin frameworks into your existing application |
as described in option b. |
<topic_end> |
<topic_start> |
local network privacy permissions |
on iOS 14 and higher, enable the dart multicast DNS |
service in the debug version of your app |
to add debugging functionalities such as hot-reload and |
DevTools via flutter attach. |
warning warning |
this service must not be enabled in the release |
version of your app, or you might experience app store rejections. |
one way to do this is to maintain a separate copy of your app’s info.plist per |
build configuration. the following instructions assume |
the default debug and release. |
adjust the names as needed depending on your app’s build configurations. |
rename your app’s info.plist to Info-Debug.plist. |
make a copy of it called Info-Release.plist and add it to your xcode project. |
in Info-Debug.plist only add the key NSBonjourServices |
and set the value to an array with the string _dartVmService._tcp. |
note xcode will display this as “bonjour services”. |
optionally, add the key NSLocalNetworkUsageDescription set to your |
desired customized permission dialog text. |
in your target’s build settings, change the info.plist file |
(infoplist_file) setting path from path/to/Info.plist to path/to/Info-$(CONFIGURATION).plist. |
this will resolve to the path Info-Debug.plist in debug and |
Info-Release.plist in release. |
alternatively, you can explicitly set the debug path to Info-Debug.plist |
and the release path to Info-Release.plist. |
if the Info-Release.plist copy is in your target’s build settings > build phases > copy bundle |
resources build phase, remove it. |
the first flutter screen loaded by your debug app will now prompt |
for local network permission. the permission can also be allowed by enabling |
settings > privacy > local network > your app. |
<topic_end> |
<topic_start> |
apple silicon (arm64 macs) |
on an apple silicon (m1) mac, the host app builds for an arm64 simulator. |
while flutter supports arm64 simulators, some plugins might not. if you use |
one of these plugins, you might see a compilation error like undefined symbols |
for architecture arm64 and you must exclude arm64 from the simulator |
architectures in your host app. |
in your host app target, find the excluded architectures (excluded_archs) build setting. |
click the right arrow disclosure indicator icon to expand the available build configurations. |
hover over debug and click the plus icon. change any SDK to any iOS simulator SDK. |
add arm64 to the build settings value. |
when done correctly, xcode will add "excluded_archs[sdk=iphonesimulator*]" = arm64; to your project.pbxproj file. |
repeat for any iOS unit test targets. |
<topic_end> |
<topic_start> |
development |
you can now add a flutter screen to your existing application. |
<topic_end> |
<topic_start> |
add a flutter screen to an iOS app |
this guide describes how to add a single flutter screen to an existing iOS app. |
<topic_end> |
<topic_start> |
start a FlutterEngine and FlutterViewController |
to launch a flutter screen from an existing iOS, you start a |
FlutterEngine and a FlutterViewController. |
the FlutterEngine serves as a host to the dart VM and your flutter runtime, |
and the FlutterViewController attaches to a FlutterEngine to pass |
input events into flutter and to display frames rendered by the |
FlutterEngine. |
the FlutterEngine might have the same lifespan as your |
FlutterViewController or outlive your FlutterViewController. |
lightbulb tip |
it’s generally recommended to pre-warm a long-lived |
FlutterEngine for your application because: |
see loading sequence and performance |
for more analysis on the latency and memory |
trade-offs of pre-warming an engine. |
<topic_end> |
<topic_start> |
create a FlutterEngine |
where you create a FlutterEngine depends on your host app. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.