jukaiit

 

如果你在2019年8月之前将Flutter添加到现有iOS项目,本文值得你一看。

2019年7月30日,合并合并请求flutter / flutter#36793之前Flutter 1.8.4-pre.21

将Flutter添加到现有的iOS应用程序需要更改Podfile,

并在现有Xcode项目中添加运行脚本构建阶段。

要在此拉取请求之后更新到Flutter,您必须更改Podfile,删除“运行脚本”构建阶段,然后重新生成podhelper脚本。

Podfile的改变

以前,需要将以下几行添加到Podfile

flutter_application_path = \'path/to/my_flutter/\'
eval(File.read(File.join(flutter_application_path, \'.ios\', \'Flutter\', \'podhelper.rb\')), binding)

 

 

这应该更新为:

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

 

构建阶段,用于构建Dart代码

以前,需要将构建阶段添加到现有Xcode项目中:

"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build
"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed

此构建阶段不再是必需的,必须删除。

 

重新生成podhelper.rb

cd \'path/to/my_flutter/\'
rm .ios/Flutter/podhelper.rb
flutter build ios

 

分类:

技术点:

相关文章: