gpt4 book ai didi

xcode - GoogleService-Info.plist : Copy bundle resources or not

转载 作者:行者123 更新时间:2023-12-05 01:39:42 24 4
gpt4 key购买 nike

我使用 flutter flavors(dev 和 prod)并且我各自的 GoogleServices-Info.plist 文件分别存在于 Firebase/dev Firebase/prod 文件夹中

我使用“构建阶段”脚本在构建时使用以下脚本将文件复制到 Runner/目录

if [ "${CONFIGURATION}" == "Debug-prod" ] || [ "${CONFIGURATION}" == "Release-prod" ] || [ "${CONFIGURATION}" == "Release" ]; then
cp -r "${PROJECT_DIR}/Firebase/prod/GoogleService-Info.plist" "${PROJECT_DIR}/Runner/GoogleService-Info.plist"

echo "Production plist copied"

elif [ "${CONFIGURATION}" == "Debug-dev" ] || [ "${CONFIGURATION}" == "Release-dev" ] || [ "${CONFIGURATION}" == "Debug" ]; then

cp -r "${PROJECT_DIR}/Firebase/dev/GoogleService-Info.plist" "${PROJECT_DIR}/Runner/GoogleService-Info.plist"

echo "Development plist copied"
fi

一切正常,直到我尝试将 CI/CD 与 codemagic 结合使用。

(1) 首先我从 codemagic 构建中得到这个错误(但在本地工作正常)

error: Build input file cannot be found: >'/Users/builder/clone/ios/Runner/GoogleService-Info.plist'

(2) 然后我从 Xcode 目标的“复制包资源”中删除了文件。现在我得到以下错误(本地和 codemagic):

error: Could not get GOOGLE_APP_ID in Google Services file from build environment

为了让构建在本地和 codemagic 中都正常工作,我应该保持什么样的正确设置?

Update: After a bit of pondering, looks like (1) is the correct setting. > GoogleServices-Info.plist should be part of the copy bundle resources. >ADDITIONALLY, Runner/GoogleServices-Info.plist MUST exist before build >starts. So I placed a default plist file in the directory and it worked. >My Build Phases script will override this default plist file to >appropriate file based on the flavor

最佳答案

经过一番琢磨,看起来(1)是正确的设置。 GoogleServices-Info.plist 应该是复制包资源的一部分。

另外,Runner/GoogleServices-Info.plist 必须在构建开始之前存在。所以我在目录中放置了一个默认的 plist 文件并且它起作用了。我的 Build Phases 脚本将覆盖此默认 plist 文件以 >根据风格选择合适的文件

关于xcode - GoogleService-Info.plist : Copy bundle resources or not,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57796294/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com