1.在原生的iOS工程里面,嵌套了flutter模块,进行打包时,报以下错误:
ld: bitcode bundle could not be generated because ‘/Users/—/ios/Flutter/Flutter.framework/Flutter’ was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file ‘/Users/—r/ios/Flutter/Flutter.framework/Flutter’ for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation) Search for Enable Bitcode setting and set it to YES for Debug and Release modes.
从报错信息来看,该报错信息是因为flutter模块里面的内容不是全部支持bitcode导致的,但我将项目里面的Enable Bitcode设置为NO时,并没有解决问题:
最后在Stack Overflow上面找到了答案,正确操作是:不需要将Enable Bitcode设置为NO,在flutter项目里面,依次执行以下命令:
flutter clean
flutter build ios
然后再在原生工程里面做正常的打包操作,成功!!
————————————————
2.flutter打包出现支持架构报错
报错原因:打包时应该是在真机设备上的支持架构,但是flutter.framework所支持的架构包含了模拟器的架构,所以报错。故将虚拟机架构从所支持的架构中移除就好了。
一、iOS设备支持的指令集
armv6:
iPhone, iPhone 3G, iPod 1G/2G
armv7:
iPhone 3GS, iPhone 4, iPhone 4S, iPod 3G/4G/5G, iPad, iPad 2, iPad 3, iPad Mini
armv7s:
iPhone 5, iPhone 5c, iPad 4
arm64:
iPhone X,iPhone 8(Plus),iPhone 7(Plus),iPhone 6(Plus),iPhone 6s(Plus), iPhone 5s, iPad Air(2), Retina iPad Mini(2,3)
arm64e:
iPhone XS\XR\XS Max
二、编译出现报错
打包时Xcode报错
flutter.framework支持架构过多
三、解决办法
在2019年8月份之前的flutter moudel的集成方式可按照以下方式去集成
方法1.删除对应Flutter.framework的x86_64架构
cd 到/path/xxx.framework位置
lipo -info /path/xxx.framework/xxx 查看框架支持的架构
如:lipo -info Users/pppppp/oooooo/path/xxx.framework/xxx
删除Flutter模块x86_64:lipo -remove x86_64 xxx -o xxx
如:lipo -remove x86_64 Flutter -o Flutter
方法2.在最后run script中,添加"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" thin