一、新建flutter项目在Xcode中
1、在项目的文件中创建flutter项目
flutter create --template module my_flutter
//如下表示创建成功
All done!
Your module code is in my_flutter/lib/main.dart.
2、在Xcode中CocoaPods管理项目
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
# 添加模块所在路径
flutter_application_path = '../my_flutter'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
target 'ios_my_test' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# 安装Flutter模块
install_all_flutter_pods(flutter_application_path)
# Pods for ios_my_test
end
二、flutter打包成framework
1、制作framework,使用如下命令:
flutter build ios --debug
flutter build ios --release --no-codesign
//如下就表示构建完成
Building com.example.flutterModuleLU for device (ios-release)...
Running Xcode build...
└─Compiling, linking and signing... 5.7s
Xcode build done. 37.5s
生成的framework如下:
2、将framework导入项目
image.png3、Xcode中的设置
3.1 App.framework/App' does not contain bitcode.
,需要把bitcode关了
3.2 添加framework
设置的 General > Frameworks, Libraries, and Embedded Content 下,然后在 Embed 下拉列表中选择 “Embed & Sign”。
网友评论