text stringlengths 1 372 |
|---|
load file.join(flutter_application_path, '.ios', 'flutter', 'podhelper.rb') |
<code_end> |
for each podfile target that needs to |
embed flutter, call install_all_flutter_pods(flutter_application_path). |
<code_start> |
target 'myapp' do |
install_all_flutter_pods(flutter_application_path) |
end |
<code_end> |
in the podfile’s post_install block, call flutter_post_install(installer). |
<code_start> |
post_install do |installer| |
flutter_post_install(installer) if defined?(flutter_post_install) |
end |
<code_end> |
info note |
the flutter_post_install method (added in flutter 3.1.0), |
adds build settings to support native apple silicon arm64 iOS simulators. |
include the if defined?(flutter_post_install) check to ensure your podfile |
is valid if you are running on older versions of flutter that don’t have this method. |
run pod install. |
info note |
when you change the flutter plugin dependencies in |
my_flutter/pubspec.yaml, run flutter pub get |
in your flutter module directory to refresh the list |
of plugins read by the podhelper.rb script. |
then, run pod install again from |
your application at some/path/MyApp. |
the podhelper.rb script embeds your plugins, |
flutter.framework, and app.framework into your project. |
your app’s debug and release build configurations embed |
the debug or release build modes of flutter, respectively. |
add a profile build configuration |
to your app to test in profile mode. |
lightbulb tip |
flutter.framework is the bundle for the flutter engine, |
and app.framework is the compiled dart code for this project. |
open MyApp.xcworkspace in xcode. |
you can now build the project using ⌘b. |
<topic_end> |
<topic_start> |
option b - embed frameworks in xcode |
alternatively, you can generate the necessary frameworks |
and embed them in your application by manually editing |
your existing xcode project. you might do this if members of your |
team can’t locally install flutter SDK and CocoaPods, |
or if you don’t want to use CocoaPods |
as a dependency manager in your existing applications. |
you must run flutter build ios-framework |
every time you make code changes in your flutter module. |
the following example assumes that you want to generate the |
frameworks to some/path/MyApp/Flutter/. |
warning warning |
always use flutter.xcframework and app.xcframework |
from the same directory. mixing .xcframework imports |
from different directories (such as Profile/Flutter.xcframework |
with Debug/App.xcframework) causes runtime crashes. |
link and embed the generated frameworks into your existing |
application in xcode. there are multiple ways to do |
this—use the method that is best for your project. |
<topic_end> |
<topic_start> |
link on the frameworks |
for example, you can drag the frameworks from |
some/path/MyApp/Flutter/Release/ in finder |
into your target’s build |
settings > build phases > link binary with libraries. |
in the target’s build settings, add $(project_dir)/flutter/release/ |
to the framework search paths (framework_search_paths). |
lightbulb tip |
to use the simulator, you will need to |
embed the debug version of the flutter frameworks in your |
debug build configuration. to do this |
you can use $(project_dir)/flutter/$(configuration) |
in the framework search paths (framework_search_paths) |
build setting. this embeds the release frameworks in the release configuration, |
and the debug frameworks in the debug configuration. |
you must also open MyApp.xcodeproj/project.pbxproj (from finder) |
and replace path = Flutter/Release/example.xcframework; |
with path = "flutter/$(configuration)/example.xcframework"; |
for all added frameworks. (note the added ".) |
<topic_end> |
<topic_start> |
embed the frameworks |
the generated dynamic frameworks must be embedded |
into your app to be loaded at runtime. |
error important |
plugins might produce static or dynamic frameworks. |
static frameworks should be linked on, but never embedded. |
if you embed a static framework into your application, |
your application is not publishable to the app store |
and fails with a |
found an unexpected Mach-O header code archive error. |
after linking the frameworks, you should see them in the |
frameworks, libraries, and embedded content |
section of your target’s general settings. |
to embed the dynamic frameworks |
select embed & sign. |
they will then appear under embed frameworks within |
build phases as follows: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.