若是你在2019年8月以前将Flutter添加到现有iOS项目,本文值得你一看。ios
在2019年7月30日,合并合并请求flutter / flutter#36793以前Flutter 1.8.4-pre.21
,git
将Flutter添加到现有的iOS应用程序须要更改Podfile,github
并在现有Xcode项目中添加运行脚本构建阶段。xcode
要在此拉取请求以后更新到Flutter,您必须更改Podfile,删除“运行脚本”构建阶段,而后从新生成podhelper脚本。app
之前,须要将如下几行添加到Podfile
:ui
flutter_application_path = 'path/to/my_flutter/' eval(File.read(File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')), binding)
这应该更新为:spa
flutter_application_path = 'path/to/my_flutter/' load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb') target 'MyApp' do install_all_flutter_pods(flutter_application_path) end target 'MyAppTests' do install_all_flutter_pods(flutter_application_path) end
之前,须要将构建阶段添加到现有Xcode项目中:code
"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed
此构建阶段再也不是必需的,必须删除。blog
cd 'path/to/my_flutter/' rm .ios/Flutter/podhelper.rb flutter build ios