混编配置可以参考这篇文章 www.jianshu.com/p/eee692736…
最近开始在项目的边缘模块中尝试使用Flutter开发,对混编过程中遇到的问题做了一些记录。
1、使用了cocoapods
在Debug.xcconfig和Release.xcconfig里面添加
注意FlutterMixed 是自己iOS项目的名称
#include "Pods/Target Support Files/Pods-FlutterMixed/Pods-FlutterMixed.debug.xcconfig"
#include "Pods/Target Support Files/Pods-FlutterMixed/Pods-FlutterMixed.release.xcconfig"
2、找不到FLUTTER_ROOT
在项目中手动添加文件目录
open Project Target and add User-Defined Setting with key name FLUTTER_ROOTwith the value of your flutter SDK location.
3、The path lib/main.dart does not exist
config文件的../../路径问题
4、dyld: Library not loaded: @rpath/Flutter.framework/Flutter
5、debug环境 跳转黑屏
移除App.framework
6、Flutter doctor ,Flutter upgrade 等卡住
挂终端ss
export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;
端口不一定相同,根据自己的ss配置修改
7、xcode运行脚本卡住
用Android studio 运行一次flutter应用
8、iOS风格的AppBar
return new Scaffold(
appBar: new CupertinoNavigationBar(
middle: new Text('test'),
trailing: Material(child: IconButton(icon: Icon(Icons.settings))),
),
body: Text('test'),
);
9、release包 不加载图片资源
1.更新flutter 版本
flutter upgrade
2.删除原生项目中的App.framework及Flutter.framework文件重新添加
注:Flutter在1.2版本中将flutter_assets 文件夹的内容移到了App.framework中,不需要再将flutter_assets文件添加至原生工程中
10、上传App Store 包含[x86_64]报错
App Store Connect Operation Error
ERROR ITMS-90087: "Unsupported Architectures. The executable for LoanCalculator.app/Frameworks/Flutter.framework contains unsupported architectures '[x86_64]'."
App Store Connect Operation Error
ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'LoanCalculator.app/Frameworks/Flutter.framework/Flutter' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."
App Store Connect Operation Error
ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker."
解决方法
1.打开终端
2.cd到Flutter.framework文件夹
example : cd /Users/MAC/Desktop/Flutter/Flutter.framework
3.执行下面代码
lipo -remove x86_64 Flutter -o Flutter
4.重新打开项目 Clean, Build & Run and Create Archive
ps:
目前项目只是很少的一部分尝试用Flutter来写,遇到的问题就上面这些,后面踩到坑会陆续添加进来。个人对Flutter技术十分看好,但是目前就使用体验来讲,我觉得距离iOS原生还有不小的差距,让iOS有了安卓味,这可不太好,希望后面会更完善吧。