1.创建一个iOS原生项目
2.创建一个flutter_module
(1)命令行创建
flutter create -t module flutter_module
(2)as创建
截屏2020-09-07 17.46.06.png
截屏2020-09-07 17.49.07.png
截屏2020-09-07 17.49.17.png
(3)给iOS项目使用cocoapods
# Uncomment the next line to define a global platform for your project
flutter_application_path = '../flutter_module'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
platform :ios, '9.0'
target 'NativeDemo' do
install_all_flutter_pods(flutter_application_path)
use_frameworks!
# Pods for NativeDemo
end
将上面的复制到Podfile中
../flutter_module : 相对路径(根据创建的flutter_module修改)
NativeDemo : iOS项目名(根据iOS原生项目名修改)
(3)然后重新pod install
pod install
(4)如果报错,参考:
https://www.jianshu.com/p/2a2e300a938b
网友评论