iOS项目集成flutter

1.创建flutter module

假设我们已经有了一个iOS项目,路径为 path/nativeAddFlutter/Test(工程名),那我们要在TestFlutter同级目录下创建 flutter module

cd /Users/huangzengsong/Desktop/nativeAddFlutter
flutter create -t module my_flutter

 执行后结果为

 

 

 

 

2.配置Podfile

集成flutter需要用到CocoaPods进行依赖管理,因为flutter项目会用到很多第三方插件。

A.配置路径

B.给需要用到flutter的Target添加

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'

flutter_application_path = '/Users/huangzengsong/Desktop/nativeAddFlutter/my_flutter'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')

target 'Test' do
pod 'AFNetworking'

install_all_flutter_pods(flutter_application_path)

end

 

C.执行pod install

cd /Users/huangzengsong/Desktop/nativeAddFlutter/Test
pod install

 执行后结果为

 

 3.禁用bitcode

flutter不支持bitcode,所以在项目中要设置ENABLE_BITCODE为NO,选择对应Target ,然后找到Build Settings->Build Options->Enable Bitcode改为NO即可

 

 



 

 

 

参考:https://www.cnblogs.com/tangjianfeng/p/12382781.html

posted @ 2022-05-19 09:45  黄增松  阅读(142)  评论(0编辑  收藏  举报