背景
给现有的iOS工程 通过 AddToApp
的方式集成 Flutter Module
时,报了如下错误:
一开始,没留意其具体描述,后来展开错误,看到了解释:
原文如下:
========================================================================
ERROR: Unknown FLUTTER_BUILD_MODE: dev.
Valid values are 'Debug', 'Profile', or 'Release' (case insensitive).
This is controlled by the FLUTTER_BUILD_MODE environment variable.
If that is not set, the CONFIGURATION environment variable is used.
You can fix this by either adding an appropriately named build
configuration, or adding an appropriate value for FLUTTER_BUILD_MODE to the
.xcconfig file for the current build configuration (Dev).
========================================================================
Command PhaseScriptExecution failed with a nonzero exit code
解决
如上介绍,报错的原因,是我们的工程 用了自定义的 Target
(为了方便构建不同的包),使得不识别当前的环境变量 CONFIGURATION = dev
也如上介绍,在不影响当前工程配置的前提下,我们只要添加 FLUTTER_BUILD_MODE
环境变量,并指定为有效值即可:
Valid values are 'Debug', 'Profile', or 'Release' (case insensitive).
即:在当前Target 对应的 .xcconfig
文件中添加如下定义
FLUTTER_BUILD_MODE = Debug
亲测有效~