Fabric Crashlytics适用于iOS应用程序的多种环境 [英] Fabric Crashlytics multiple environments for iOS app

查看:56
本文介绍了Fabric Crashlytics适用于iOS应用程序的多种环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Fabric Crashlytics Advanced Setup ,建议为每个版本使用单独的组织。

There is a Apps with Multiple Environments section in Fabric Crashlytics Advanced Setup that suggests to use a separate organization for each version.

我为每个Build配置创建了3个单独的组织:

I have created 3 separate organizations per each Build configuration:


  • MyApp

  • MyApp(调试)

  • MyApp(AdHoc)

我在 Run Script Build Phase (运行脚本构建阶段)中有一个条件,该条件以不同的 API密钥 Build Secret ,我可以确认条件是否正确,但是我仍然无法在我的plist中更新API密钥(猜测面料用途)。似乎Fabric会将崩溃信息发送给我使用Fabric应用程序注册的最后一个API密钥/组织。有什么我想念的吗?我知道我可以使用 [Crashlytics initWithApiKey:@] ,但是根据我的阅读,这被认为是遗留代码。

I've got a conditional in my Run Script Build Phase that runs the Fabric framework script with different API Keys and Build Secrets and I can confirm that the conditional is being hit right, but I still do not get the API Keys updated in my plist (which I'm guessing Fabric uses). It seems like Fabric is sending my crashes to the last API key / organization that I on-boarded using the Fabric app. Is there something I'm missing? I know I can use [Crashlytics initWithApiKey:@""], but from what I've read this is considered legacy code.

这是我的运行脚本构建阶段:

Here is my Run Script Build Phase:

if [ "${CONFIGURATION}" = "Distribution" ]; then
echo "Building Fabric for Distribution."
./Fabric.framework/run dist_api_key dist_build_secret
fi

if [ "${CONFIGURATION}" = "AdHoc" ]; then
echo "Building Fabric for AdHoc."
./Fabric.framework/run adhoc_api_key adhoc_build_secret
fi

if [ "${CONFIGURATION}" = "Debug" ]; then
echo "Building Fabric for Debug."
./Fabric.framework/run debug_api_key debug_build_secret
fi

原始问题

推荐答案

为使此功能正常运行,我这样做了:

In attempt to get this working I did this:


  1. 添加自定义用户定义的设置到构建设置,例如 MY_CRASHLYTICS_API_KEY MY_CRASHLYTICS_BUILD_SECRET

  2. Info.plist中替换具体的APIKey 在Fabric组下,具有 $ {MY_CRASHLYTICS_API_KEY}

  3. 分别添加 API密钥和<从您根据环境创建的组织中的strong> Build Secret ,从步骤1

  4. 在运行脚本中更改脚本下的构建设置阶段如下所示

  5. 通过Crashlytics Mac小部件配置应用程序。这也不是容易的部分。仅当应用程序以Debug配置运行时,它们才被添加到您的组织中。原因是该应用程序应保持启动和运行一段时间,以便Crashlytics可以对其进行跟踪。这要求我同时更改脚本和构建设置密钥的 Api密钥和构建秘密,并注册该应用程序。之后,我可以更改 Info.plist 以使用构建设置中的环境变量。

  1. add custom user-defined setting to the Build Settings, e.g. MY_CRASHLYTICS_API_KEY and MY_CRASHLYTICS_BUILD_SECRET
  2. replace concrete APIKey in Info.plist under Fabric group with ${MY_CRASHLYTICS_API_KEY}
  3. add respective API Keys and Build Secrets from organisations you have created per the environment to Build Settings under the key from Step 1
  4. change the script in Run Script phase to be something like the below
  5. configure apps via Crashlytics Mac widget. This is not an easy part too. Apps are added to your organisations only when they are running with Debug configuration. The reason is the app should stay for a while up and running, so Crashlytics could track it down. This required me to change Api Keys and Build Secrets for both, the script and the Build Settings key and get the app registered. After that I was able to change Info.plist to use the environment var from build settings.

运行脚本:

echo "Running Crashlytics (${CONFIGURATION})"
"${PODS_ROOT}/Fabric/Fabric.framework/run" ${MY_CRASHLYTICS_API_KEY} ${MY_CRASHLYTICS_BUILD_SECRET}

这篇关于Fabric Crashlytics适用于iOS应用程序的多种环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆