Crashlytics Fabric多个目标

时间:2017-04-19 14:34:50

标签: crashlytics google-fabric

我有一个包含多个目标的应用,其中一些具有不同的捆绑ID。我已经设法将Fabric,特别是Crashlytics添加到过去具有相同捆绑ID的应用中,但我不确定如何使用不同的捆绑ID来实现多个目标。

我可能错过了任何指针或文档?

4 个答案:

答案 0 :(得分:6)

您可以在单个应用中为多个目标创建 Crashlytics ,方法是在构建阶段中添加多个 RUN SCRIPT 。 Fabric将根据 UNIQUE RUN SCRIPT

进行识别

我正在单个项目中处理6个目标,在Fabric By中明智地完成所有崩溃。

目标 - >构建阶段 - >添加运行脚本

答案 1 :(得分:4)

来自Fabric' documentation

  

要运行具有多个目标的Crashlytics,请为每个目标的构建阶段添加Crashlytics Run Script。

在我的项目中,我为主要的应用程序目标配置了Fabric,以及在他们自己的目标中的几个扩展,这对我来说很好。它们最终表现为独特的东西"在Fabric web仪表板中也很好。

答案 2 :(得分:0)

在使用Firebase安装Crashlytic时,对于多种方案,您可能会遇到错误Could not get GOOGLE_APP_ID in Google Services file from build environment。您可以通过以下方式修复它:

  • Build Settings的{​​{1}}中添加用户定义的文件名:

Add file name for each scheme in User Defined

  • User Defined的Crashlytic构建阶段上方,点击加号Build Phases,然后在文本字段中键入此代码。请记住,将%YOUR_CUSTOM_PATH_TO_FOLDER%重命名为Plist文件的路径:
New Run Script Phase

Add build phase

答案 3 :(得分:0)

如果您希望在iOS中为多个目标实现Crashlytics,这是 Tyler Milner 的不错的文章。

https://medium.com/rocket-fuel/using-multiple-firebase-environments-in-ios-12b204cfa6c0

它提供了一个脚本,可以根据目标自动选择 GoogleService-Info.plist 文件。您可能需要稍微修改脚本以反映应用程序的目标名称,例如:“发布”。

# Name of the resource we're selectively copying
GOOGLESERVICE_INFO_PLIST=GoogleService-Info.plist

# Get references to dev and prod versions of the GoogleService-Info.plist
# NOTE: These should only live on the file system and should NOT be part of the target (since we'll be adding them to the target manually)
GOOGLESERVICE_INFO_DEV=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Dev/${GOOGLESERVICE_INFO_PLIST}
GOOGLESERVICE_INFO_PROD=${PROJECT_DIR}/${TARGET_NAME}/Firebase/Prod/${GOOGLESERVICE_INFO_PLIST}

# Make sure the dev version of GoogleService-Info.plist exists
echo "Looking for ${GOOGLESERVICE_INFO_PLIST} in ${GOOGLESERVICE_INFO_DEV}"
if [ ! -f $GOOGLESERVICE_INFO_DEV ]
then
    echo "No Development GoogleService-Info.plist found. Please ensure it's in the proper directory."
    exit 1
fi

# Make sure the prod version of GoogleService-Info.plist exists
echo "Looking for ${GOOGLESERVICE_INFO_PLIST} in ${GOOGLESERVICE_INFO_PROD}"
if [ ! -f $GOOGLESERVICE_INFO_PROD ]
then
    echo "No Production GoogleService-Info.plist found. Please ensure it's in the proper directory."
    exit 1
fi

# Get a reference to the destination location for the GoogleService-Info.plist
PLIST_DESTINATION=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app
echo "Will copy ${GOOGLESERVICE_INFO_PLIST} to final destination: ${PLIST_DESTINATION}"

# Copy over the prod GoogleService-Info.plist for Release builds
if [ "${CONFIGURATION}" == "Release" ]
then
    echo "Using ${GOOGLESERVICE_INFO_PROD}"
    cp "${GOOGLESERVICE_INFO_PROD}" "${PLIST_DESTINATION}"
else
    echo "Using ${GOOGLESERVICE_INFO_DEV}"
    cp "${GOOGLESERVICE_INFO_DEV}" "${PLIST_DESTINATION}"
fi