![](/img/trans.png)
[英]Building iOS app for iPhone works from xCode but not from command line (xcodebuild)
[英]Building iOS app using Xcode works, but building the same app with xcodebuild command fails
由於xcodebuild
工具失敗,新的 flutter 和新的 react-native 項目都無法構建。 但是,當我在 Xcode 中手動構建項目時,它們會成功。
顯然,原因是因為xcodebuild
在構建過程中添加了額外的標志,即:
export OTHER_CPLUSPLUSFLAGS=" -fmodule-map-file="/Users/aa/code/WW2/ios/Pods/Headers/Public/SSZipArchive/SSZipArchive.modulemap""
結果是構建失敗,因為找不到上述模塊映射,出現以下錯誤:
<unknown>:0: error: module map file '/Users/aa/code/WW2/ios/Pods/Headers/Public/SSZipArchive/SSZipArchive.modulemap' not found
所述模塊圖來自我移動的先前項目(稱為WW2
)。 但問題是,即使是新創建的項目也會受到影響。
我浪費了兩天時間來解決這個問題,甚至通讀了有關 xcode 構建設置的文檔,但無濟於事。 我要做的是找到這個附加標志或配置的來源。 我什至使用 grep 來查找包含特定標志的文件,但它尚未完成對我的系統的掃描。
所以問題是 $PODS_ROOT 變量以某種方式設置為/Users/aa/code/WW2/ios/Pods
,可能是由於取消了 npm 構建。 我只需要重新啟動終端,問題就解決了。
附帶說明一下,我應該在 finder 中使用搜索功能,因為它使用的索引與 grep 不同,因此速度要快得多。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.