作为 Xcode 构建过程的一部分,如何运行上传符号来上传 dSYM?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/54577202/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:54:09  来源:igfitidea点击:

How to run upload symbols to upload dSYMs as a part of Xcode build process?

iosswiftxcodecrashlyticsdsym

提问by user3554626

Ok, so I'm trying to automatically upload dSYMs. I'm following instructions from this official documentation: https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports

好的,所以我正在尝试自动上传 dSYM。我正在遵循此官方文档中的说明:https: //firebase.google.com/docs/crashlytics/get-deobfuscated-reports

I'm stuck at "Run the upload symbols script manually" section. There are 3 ways to upload dSYMs. I'm trying to follow the first one - including the following line in your build process: find ${DWARF_DSYM_FOLDER_PATH} -name "*.dSYM" | xargs -I \{\} ${PODS_ROOT}/Fabric/upload-symbols -gsp MyProjectFolder/GoogleService-Info.plist -p ios \{\}

我被困在“手动运行上传符号脚本”部分。有 3 种方法可以上传 dSYM。我正在尝试遵循第一个 - 在您的构建过程中包括以下行: find ${DWARF_DSYM_FOLDER_PATH} -name "*.dSYM" | xargs -I \{\} ${PODS_ROOT}/Fabric/upload-symbols -gsp MyProjectFolder/GoogleService-Info.plist -p ios \{\}

For now I've tried the following:

现在我已经尝试了以下方法:

  1. I go to Project->Scheme->Edit Scheme.
  2. I click on Build->Post actions
  3. I start small - I only want to show "echo" in build process: dSYMs
  4. I run Product->Build
  5. I go to View->Navigators->Show Report Navigator
  6. There's not indication that echo was run.
  1. 我去项目->方案->编辑方案。
  2. 我点击构建->发布操作
  3. 我从小处开始 - 我只想在构建过程中显示“回声”: 同步信号
  4. 我运行产品->构建
  5. 我去查看->导航器->显示报告导航器
  6. 没有迹象表明 echo 已运行。

Where to put this script?

把这个脚本放在哪里?

How to find if it is being run or not?

如何查看它是否正在运行?

采纳答案by C. Kontos

Try the following steps:

尝试以下步骤:

Step 1: Select your application's Xcode project, then your application target, then select "Build Phases".

第 1 步:选择您的应用程序的 Xcode 项目,然后选择您的应用程序目标,然后选择“构建阶段”。

Step 2: In Xcode menu, select "Editor", then select "Add Build Phase", and then click on "Add Run Script Build Phase".

第二步:在Xcode菜单中,选择“Editor”,然后选择“Add Build Phase”,然后点击“Add Run Script Build Phase”。

Step 3: You should now see a Run Script section in your Build Phase options.

第 3 步:您现在应该在 Build Phase 选项中看到 Run Script 部分。

Step 4: Paste in the script inside the body of the Run Script Build Phase.

第 4 步:将脚本粘贴到运行脚本构建阶段的主体内。

Keep in mind to set the right file-path(s) in your script(s).

请记住在脚本中设置正确的文件路径。

回答by Mike Hardy

TL;DR:dSYMS generated at build time has little value in the "bitcode enabled" era, you need to download dSYMs from Apple and upload them to your 3rd party crash reporter service as a post-build step after Apple has processed your upload.

TL;DR:在构建时生成的 dSYMS 在“启用位码”时代几乎没有价值,您需要从 Apple 下载 dSYM 并将它们上传到您的第 3 方崩溃报告服务,作为 Apple 处理您的上传后的构建后步骤。

Background

背景

Symptom

症状

Missing dSYMs / failed symbolication in 3rd party crash reporting console. I thought despite following Crashlytics install instructions the script was failing.

在第 3 方崩溃报告控制台中缺少 dSYM/失败的符号。我认为尽管遵循 Crashlytics 安装说明,脚本还是失败了。

Bitcode - the fundamental issue

位码 - 根本问题

Turns out the 3rd party crash-reporting systems (like Crashlytics, or New Relic) have a fundamental problem with the current best practice for app distribution, which is bitcode-enabled apps. Historically these 3rd party crash report systems relied on build-time steps to upload build-time generated dSYMs. But since bitcode-enabling means the app store recompiles your apps, your build-time generated dSYMs, that you are trying to upload, are effectively useless.

事实证明,第 3 方崩溃报告系统(如 Crashlytics 或 New Relic)在应用分发的当前最佳实践中存在一个根本问题,即支持位码的应用。从历史上看,这些 3rd 方崩溃报告系统依赖于构建时步骤来上传构建时生成的 dSYM。但是由于启用位码意味着应用程序商店会重新编译您的应用程序,因此您尝试上传的构建时生成的 dSYM 实际上毫无用处。

As background, bitcode-enabled apps are "thinned" and thus re-compiled by Apple such that each device only gets the download bits it needs. You want to enable bitcode. It is a good thing. But, bitcode-enabled distribution messes up symbolication. No matter what dSYMs you generate at build time, the dSYMs won't actually correlate to crashes from App Store or TestFlight installed builds, as your crashes will be from App-store recompiled versions of your apps with new corresponding dSYMs.

作为背景,支持位码的应用程序被“精简”,因此由 Apple 重新编译,这样每个设备只能获得它需要的下载位。您想启用 bitcode。这是一件好事。但是,启用位码的分发会弄乱符号化。无论您在构建时生成什么 dSYM,dSYM 实际上都不会与 App Store 或 TestFlight 安装版本的崩溃相关联,因为您的崩溃将来自应用商店重新编译的应用程序版本,并带有新的相应 dSYM。

So don't worry about the upload script working or not at build time. In fact, that step could be removed from your build process as it is just wasting your time and bandwidth.

所以不要担心上传脚本在构建时是否工作。事实上,这一步可以从你的构建过程中删除,因为它只是在浪费你的时间和带宽。

The only case it might be useful is if you want to symbolicate crashes from locally-installed release versions instead of debugging them directly in Xcode.

它可能有用的唯一情况是,如果您想从本地安装的发布版本中符号化崩溃,而不是直接在 Xcode 中调试它们。

Solutions

解决方案

The solution is to wait "some time" (reportedly several minutes, via NewRelic documentation, in my experience a sleep of 120 seconds after fastlane upload but before I ran fastlane's download_dsyms action failed sometimes, a sleep of 300 seconds works reliably) after uploading your app (likely the duration of time the App Store says your build is "Processing"), then download the dSYMs from there and use your 3rd party crash reporters command-line upload script

解决方案是等待“一段时间”(据报道是几分钟,通过 NewRelic 文档,根据我的经验,fastlane 上传后睡眠 120 秒,但在我运行 fastlane 的 download_dsyms 操作有时失败之前,300 秒的睡眠可靠地工作)在上传您的应用程序(可能是 App Store 说您的构建是“正在处理”的持续时间),然后从那里下载 dSYMs 并使用您的 3rd 方崩溃报告器命令行上传脚本

Manual download / upload

手动下载/上传

The current recommended solutions from the 3rd party crash reporters (both NewRelic and Crashlytics documentation at least) is to either go to the App Store Connect page for the build and download dSYMs then upload, or using XCode's Organizer for the archive hit the "Download Debug Symbols" button, then upload them.

当前来自第 3 方崩溃报告者(至少包括 NewRelic 和 Crashlytics 文档)的推荐解决方案是转到 App Store Connect 页面进行构建并下载 dSYM 然后上传,或者使用 XCode 的 Organizer 进行存档点击“下载调试符号”按钮,然后上传它们。

This does work, with manual dSYM downloads pushed out to your crash reporting vendor you will get symbolicated reports. It is a manual process though using either the Xcode GUI or the App Store Connect interface.

这确实有效,将手动 dSYM 下载推送给您的崩溃报告供应商,您将获得符号化报告。尽管使用 Xcode GUI 或 App Store Connect 界面,但这是一个手动过程。

Fastlane automation

快车道自动化

You may automate the process with Fastlane though, which is I believe the proper solution.

不过,您可以使用 Fastlane 自动执行此过程,我认为这是正确的解决方案。

https://docs.fastlane.tools/actions/download_dsyms/#download_dsyms

https://docs.fastlane.tools/actions/download_dsyms/#download_dsyms

https://docs.fastlane.tools/actions/upload_symbols_to_crashlytics/

https://docs.fastlane.tools/actions/upload_symbols_to_crashlytics/

回答by AtulParmar

You need to requred update in Project Target-> Build setting -> debug information (Debug and release both) -> DWARF with dSYM file

您需要在 Project Target-> Build setting -> debug information (Debug and release both) -> DWARF with dSYM file 中要求更新

enter image description here

在此处输入图片说明