简体   繁体   English

使用 Xcode 构建 iOS 应用程序有效,但使用 xcodebuild 命令构建相同的应用程序失败

[英]Building iOS app using Xcode works, but building the same app with xcodebuild command fails

Both new flutter and new react-native projects fail to build because the xcodebuild tool fails.由于xcodebuild工具失败,新的 flutter 和新的 react-native 项目都无法构建。 They, however, succeed when I build the projects manually inside Xcode.但是,当我在 Xcode 中手动构建项目时,它们会成功。

Apparently, the reason is because xcodebuild adds additional flag during the build, that, is:显然,原因是因为xcodebuild在构建过程中添加了额外的标志,即:

export OTHER_CPLUSPLUSFLAGS=" -fmodule-map-file="/Users/aa/code/WW2/ios/Pods/Headers/Public/SSZipArchive/SSZipArchive.modulemap""

The result is that the build is failing because it cannot find the said module map, with the following error:结果是构建失败,因为找不到上述模块映射,出现以下错误:

<unknown>:0: error: module map file '/Users/aa/code/WW2/ios/Pods/Headers/Public/SSZipArchive/SSZipArchive.modulemap' not found

The said module map is from a previous project (called WW2 ) which I moved.所述模块图来自我移动的先前项目(称为WW2 )。 But the problem is that even newly-created projects are affected.但问题是,即使是新创建的项目也会受到影响。

I wasted two days to solve this, even reading through the documentation about xcode build settings, but to no avail.我浪费了两天时间来解决这个问题,甚至通读了有关 xcode 构建设置的文档,但无济于事。 What I'm trying to do is to find the source of this additional flag or configuration.我要做的是找到这个附加标志或配置的来源。 I even used grep to find a file containing the particular flag, but it's not yet finished scanning my system.我什至使用 grep 来查找包含特定标志的文件,但它尚未完成对我的系统的扫描。

So the problem is somehow the $PODS_ROOT variable is set to /Users/aa/code/WW2/ios/Pods , probably due to a canceled npm build.所以问题是 $PODS_ROOT 变量以某种方式设置为/Users/aa/code/WW2/ios/Pods ,可能是由于取消了 npm 构建。 I only needed to restart the terminal and the problem is solved.我只需要重新启动终端,问题就解决了。

As a side note, I should have used the search function in the finder as it's much faster because it uses an index unlike grep.附带说明一下,我应该在 finder 中使用搜索功能,因为它使用的索引与 grep 不同,因此速度要快得多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM