xcode 只在 Testflight 上崩溃

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12190121/
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 01:22:13  来源:igfitidea点击:

Only crashing on Testflight

iosxcodetestflight

提问by daidai

We're using TestFlight to send out pilots of our app.

我们正在使用 TestFlight 派遣我们的应用程序的飞行员。

There's a part of the app that is crashing, and we had a lot of trouble reproducing the crash. The code their is fairly simple.

应用程序的一部分崩溃了,我们在重现崩溃时遇到了很多麻烦。他们的代码相当简单。

It turns out that the users who got the App via TestFlight get the crash, while if you build the app and install it using the IDE it doesn't crash!

事实证明,通过 TestFlight 获得应用程序的用户会崩溃,而如果您构建应用程序并使用 IDE 安装它,它不会崩溃!

Anyone have ideas about what might be causing this?

任何人都知道可能导致这种情况的原因?

Any ideas for workarounds? We don't want to stop using TestFlight.

任何解决方法的想法?我们不想停止使用 TestFlight。

采纳答案by Ben Trengrove

Make sure to build your app in Release Mode not in Debug. The app may only crash when in Release.

确保在发布模式而不是调试模式下构建您的应用程序。该应用程序可能只有在发布时才会崩溃。

回答by Blanka

The first thing I'd try is to map the crash stack trace to function names in your application. This may yield useful insight into the nature of the crash:

我要尝试的第一件事是将崩溃堆栈跟踪映射到应用程序中的函数名称。这可能会对崩溃的性质产生有用的见解:

  1. As soon as a crash is reported request the crash log. This can be obtained through Xcode's organizer or if that's not an option it can be screen-captured from the iPhone's Settings -> General -> About -> Diagnostics & Usage -> Diagnostic & Usage Data. Scroll to the app name or the section LatestCrash-AppName.plist.
  2. Although you can in theory symbolicate a crash, I find the procedure described below a foolproof way to get symbols from the stack. Convert all stack addresses for the crashing thread into method names.
  3. Optionally request the iDevice syslog. This may include assertion failure messages which are also invaluable. Note that this should be done as quickly as possible as the syslog only holds so many entries before they get dropped. You can use the Organizer or the cmd line idevicesyslog to obtain this.
  1. 报告崩溃后立即请求崩溃日志。这可以通过 Xcode 的管理器获得,或者如果这不是一个选项,它可以从 iPhone 的设置 -> 常规 -> 关于 -> 诊断和使用 -> 诊断和使用数据进行屏幕捕获。滚动到应用程序名称或部分 LatestCrash-AppName.plist。
  2. 尽管理论上您可以象征崩溃,但我发现下面描述的过程是从堆栈中获取符号的万无一失的方法。将崩溃线程的所有堆栈地址转换为方法名称。
  3. (可选)请求 iDevice 系统日志。这可能包括同样非常宝贵的断言失败消息。请注意,这应该尽快完成,因为 syslog 在它们被删除之前只保存了这么多条目。您可以使用管理器或命令行 idevicesyslog 来获取它。

Manual symbolication: This will work as long as your builds have debug information.

手动符号化:只要您的构建具有调试信息,这就会起作用。

  1. Obtain the _exact_same_ .ipa that crashed. If you didn't save it you can download it from the device by using iFunBox or the cmd line ideviceinstaller utility.
  2. Unzip the .ipa
  3. Run the following command on the executable file (Payload/AppName.app/AppName):

    otool -tv AppName.app | c++filt > listing.asm

  4. Wait while the previous step completes (may take a while). The generated listing.asm file will be several megabytes long.

  5. Using an editor that can handle large files search listing.asm for the addresses listed in the stack trace. Note that the addresses may be a few bytes off (usually pointing 3 or so bytes ahead). Also, addresses that aren't found in listing.asm indicate addresses in iOS libraries. Ignore those for now.
  1. 获取崩溃的 _exact_same_ .ipa。如果您没有保存它,您可以使用 iFunBox 或命令行 ideviceinstaller 实用程序从设备下载它。
  2. 解压 .ipa
  3. 在可执行文件 (Payload/AppName.app/AppName) 上运行以下命令:

    otool -tv AppName.app | 时间:2019-05-06 标签:c++filt>listing.asm

  4. 等待上一步完成(可能需要一段时间)。生成的 listing.asm 文件将有几兆字节长。

  5. 使用可以处理大文件的编辑器 searchlisting.asm 以获取堆栈跟踪中列出的地址。请注意,地址可能相差几个字节(通常指向前方 3 个左右的字节)。此外,listing.asm 中未找到的地址表示 iOS 库中的地址。暂时忽略这些。

Of course, if you're able to symbolicate, you can skip this procedure.

当然,如果您能够进行符号化,则可以跳过此过程。

Good luck debugging!

祝调试顺利!

回答by VikrantY

We had a similar problem. The issue with us was static libraries. When we built the app from scratch and went to testflight, it was crashing but from the IDE it wasn't. The crash was because the static libraries did not get included when doing a build, but was getting included if I connected the iPad direct and used XCode to install.

我们遇到了类似的问题。我们的问题是静态库。当我们从头开始构建应用程序并进入 testflight 时,它崩溃了,但在 IDE 中却没有。崩溃是因为在构建时没有包含静态库,但是如果我直接连接 iPad 并使用 XCode 安装,就会被包含在内。

A simple test will prove this:-

一个简单的测试将证明这一点:-

1.) Instead of building from IDE, create a .app file and then load it via iTunes and check if you are getting the crash.

1.) 不是从 IDE 构建,而是创建一个 .app 文件,然后通过 iTunes 加载它并检查是否出现崩溃。

We worked around this by creating the .iPA manually, that is creating the .app then making a Payload folder and putting the .app in it along with the info.plist.

我们通过手动创建 .iPA 来解决这个问题,即创建 .app 然后创建一个 Payload 文件夹并将 .app 与 info.plist 一起放入其中。

Then things began to work in Testflight as well.

然后事情也开始在 Testflight 中发挥作用。