1.首先将flutter和原生项目放在同一级文件下面
截屏2021-04-08 上午9.47.38.png
2.接下来要在原生的oc工程中引入cocoapod来做管理,打开podfile文件
flutter_application_path = '../flutter_community_ai'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
#source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target 'SevenBubble' do
pod 'AFNetworking'
pod "Qiniu", "~> 8.1"
install_all_flutter_pods(flutter_application_path)
end
3.执行pod install命令,flutter就引入进来了
截屏2021-04-08 上午10.11.40.png
4.从原生跳转flutter页面
引入头文件 import Flutter
let flutterVC:FlutterViewController = FlutterViewController()
flutterVC.hidesBottomBarWhenPushed = true
self.navigationController?.pushViewController(flutterVC, animated: true)
网友评论