Flutter应用提交AppStore构建问题解决

上篇文已经成功将flutter运行在了iOS设备上,要提交AppStore,需要在Xcode中编译构建archive文件,而构建之前,需要使用终端在项目目录下执行 flutter build ios 命令后再构建archive文件,这时候可能会遇到2个问题(GeneratedPluginRegistrant Module ‘connectivity’ not found和error: The linked framework ‘Pods_Runner.framework’ is missing one or more
architectures required by this target: armv7. (in target ‘Runner’ from project
‘Runner’),如需要详细看到flutter build 等命令执行log,可以加-v参数,即 flutter -v build ios.

问题:在Xcode中编译出现模块未找到.如:GeneratedPluginRegistrant Module ‘connectivity’ not found,
解决:在命令行中使用flutter build ios 是可以成功编译的,在Xcode中构建则会报错,找不到Module,按理说cocospods会自动下载补全缺失的Module的,经过搜索,发现Xcode中Pods目录下缺失 Pods.xcodeproj 文件的引用.到Finder中的项目文件目录中找到Pods.xcodeproj文件添加到Xcode的Pods下,再次Build即可.

修正后如下图:

问题:执行构建命令后提示armv7等错误信息,如error: The linked framework ‘Pods_Runner.framework’ is missing one or more
architectures required by this target: armv7. (in target ‘Runner’ from project
‘Runner’)
解决:到Xcode项目中的BuildSettings添加如下字段:

EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8 EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))

增加字段后再次编译即可解决这个错误信息.

好了,今天就写到这里,回见.

参考链接:
https://xiaozhuanlan.com/topic/7938654021
https://github.com/flutter/flutter/issues/13364
https://www.gitmemory.com/issue/flutter/flutter/57200/748132735
https://qiita.com/umi_mori/items/899d8ecd37fc735c84b7
https://www.jianshu.com/p/5af69bb58916

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注