一、创建flutter
cd 至某个文件夹路径下
flutter create -t module flutter_mix (flutter_mix为自定义flutter项目名称)
二、使用Cocoapods添加依赖
1、在Podfile文件加入以下代码:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
flutter_application_path = '../flutter_mix/'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
target 'zyc_ios' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for zyc_ios
target 'zyc_iosTests' do
inherit! :search_paths
# Pods for testing
end
target 'zyc_iosUITests' do
# Pods for testing
end
install_all_flutter_pods(flutter_application_path)
end
flutter_mix为flutter自定义项目名称
2、执行pod install
如果报错[!] InvalidPodfilefile: No such file or directory @ rb_sysopen - ./my_flutter/.ios/Flutter/podhelper.rb.
需要在flutter_mix文件夹下执行以下flutter run,把.ios和.android等flutter配置生成出来。