-
在Android Studio创建的Flutter项目时不要选择Flutter Application,应该创建最后一个Flutter Module
创建的Flutter项目.png -
将Flutter项目和iOS项目放到同一级目录下(方便原生引用Flutter项目)
目录显示.png - iOS原生项目通过CocoaPods引入Flutter
platform :ios, '9.0'
use_frameworks!
target 'NavtiveDemo' do
flutter_application_path = '../flutter_module_demo/'
eval(File.read(File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')), binding)
end
- Xcode的Enable Bitcode设置为NO
- 添加编译脚本,在Xcode的Build Phases中添加New Run Script Phase在里面填入如下脚本,并且将Run Script移动到第二项
"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build
"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" embed
添加脚本png
放到当前位置.png
网友评论