ios 应用程序仅在 Testflight 构建时崩溃

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

App Crashes Only On Testflight Build

iosobjective-cxcodeswift

提问by loop

I have created an app on swift and tested it extensively using iPhone 6, iPhone 6 plus and iPhone 5 devices and all the simulators offered in Xcode. The app runs fine and does not crash when uploaded locally. (iOS 8)

我在 swift 上创建了一个应用程序,并使用 iPhone 6、iPhone 6 plus 和 iPhone 5 设备以及 Xcode 中提供的所有模拟器对其进行了广泛的测试。该应用程序运行良好,在本地上传时不会崩溃。(iOS 8)

I finally submitted a build for Testflight. The app consistently crashes at the same place after downloading the app through the Testflight build.

我终于为 Testflight 提交了一个构建。通过 Testflight 版本下载应用程序后,该应用程序始终在同一位置崩溃。

Is there a known issue where uploaded builds run differently than locally created builds? And how can I debug the issue with the Testflight build?

是否存在一个已知问题,即上传的构建与本地创建的构建运行方式不同?我该如何调试 Testflight 版本的问题?

采纳答案by loop

I solved the issue by changing the swift compiler optimization from fastestto none. I'm not sure if this is an ideal long term solution, but the build no longer crashes.

我通过将 swift 编译器优化从 更改fastestnone. 我不确定这是否是理想的长期解决方案,但构建不再崩溃。

回答by Chengappa C D

I guess its a swift compiler issue. To verify first go to Edit Schemethen change the Build configurationto Releasemode in Runtab and then install the build locally. You will get to know where exactly its crashing.

我猜它是一个快速的编译器问题。要验证首先转到编辑方案,然后在运行选项卡中将构建配置更改为发布模式,然后在本地安装构建。你会知道它到底在哪里崩溃。

回答by Dilip

It might be the Bitcoderelated issue. Check if your all third-party libraries support bitcode then and then only set bitcode to YESelse set to NO.

这可能是与Bitcode相关的问题。检查您的所有第三方库是否支持 bitcode 然后只将 bitcode 设置为YES否则设置为NO

Actually Bitcode is an intermediate representation of a compiled program. Apps you upload to iTunes Connect that contain bitcode will be compiled and linked on the App Store.

实际上,Bitcode 是已编译程序的中间表示。您上传到 iTunes Connect 的包含 bitcode 的应用程序将在 App Store 上编译和链接。

回答by brainray

In my case this happened after starting to use Xcode 11. It was a UISearchDisplayController(deprecated since iOS 8) that seems to work on a device or simulator in debug mode, but not in the release build. Xcode 11.3 doesn't give any inline warning in the code. The crash was hard to find, because the search controller wasn't used any more, it was orphaned code.

在我的情况下,这是在开始使用 Xcode 11 后发生的。它是一个UISearchDisplayController(自 iOS 8 起已弃用)似乎在调试模式下在设备或模拟器上工作,但不在发布版本中。Xcode 11.3 不会在代码中给出任何内联警告。崩溃很难找到,因为不再使用搜索控制器,它是孤立代码。

回答by HuaTham

In my case, changing Legacy Build System to New Build System (for Xcode 10) solves my issue where Testflight build behaves differently. Might be helpful to someone.

就我而言,将 Legacy Build System 更改为 New Build System(对于 Xcode 10)解决了我的问题,即 Testflight 构建的行为不同。可能对某人有帮助。

回答by amar

For all those who face this similar issue, can follow these steps

对于所有遇到此类似问题的人,可以按照以下步骤操作

Go to Xcode->widows->organiserthen select crashestab then select your app. If you have added your apple account in Xcode->preferences-> accountsthen you Xcode will download all crash reports even for the testflight build.

转到Xcode->widows->organiser,然后选择crashes选项卡,然后选择您的应用程序。如果您在Xcode->preferences->accounts 中添加了您的 Apple 帐户,那么即使是 testflight 构建,您的 Xcode 也会下载所有崩溃报告。

It will have the stack trace you don't need to symbloicate it like old times. PS:- the most common which I have seen is UISearchDisplayController issue

它将具有堆栈跟踪,您无需像过去那样对其进行符号化。PS:-我见过的最常见的是 UISearchDisplayController 问题

回答by Jay

Instead of i += 1;in the empty while loops.

而不是i += 1;在空的 while 循环中。

I did this in my empty while Loop: RunLoop.current.run(until: Date(timeIntervalSinceNow: 1))

我在我的空 while 循环中做了这个: RunLoop.current.run(until: Date(timeIntervalSinceNow: 1))

And now the TestFlight App does not bomb!

现在 TestFlight 应用程序不会爆炸!

A shorter time might also work such as: RunLoop.current.run(until: Date(timeIntervalSinceNow: 0.25))

更短的时间也可能有效,例如: RunLoop.current.run(until: Date(timeIntervalSinceNow: 0.25))

回答by K.S

Release build actually takes a different entitlement file than debug build entitlement while debugging in local.

在本地调试时,发布版本实际上采用与调试版本权利不同的权利文件。

While uploading an archive build it will take release build settings and release entitlement file by default. Make sure you have all the release settings correctly edited in the configurations.

上传存档构建时,默认情况下将采用发布构建设置和发布授权文件。确保在配置中正确编辑了所有发布设置。

回答by John Szymanski

If anyone else is having the same problem, here's what my fix was:

如果其他人遇到同样的问题,这就是我的解决方法:

I finally got the problem down to a loop with a if statement, akin to this -

我终于把问题归结为一个带有 if 语句的循环,类似于这个 -

while(condition)
{
    if (check)
    {
        code!
    }
    //There was no code here
}

Notice that there's no code at the end of the loop (where the comment is). Once I added a random bit of code (in this case, incrementing a variable for output), the problem stopped.

请注意,循环末尾(注释所在的位置)没有代码。一旦我添加了一段随机代码(在这种情况下,增加一个输出变量),问题就停止了。

while(condition)
{
    if (check)
    {
        code!
    }
    i += 1;
    output statement
}

I think this has to be a compiler error, or else my "fix" shouldn't be a fix at all. But here it is in case it helps anyone else!

我认为这必须是编译器错误,否则我的“修复”根本不应该是修复。但这里是以防万一它可以帮助其他人!

回答by Krishna Kirana

I got it (partially!). Actually "release" implementation of UI_USER_INTERFACE_IDIOM() in swift project crashes the app.

我明白了(部分!)。实际上,swift 项目中 UI_USER_INTERFACE_IDIOM() 的“发布”实现会使应用程序崩溃。

However, still I have no clue why our app store app (objective c language based) does NOT crash.

但是,我仍然不知道为什么我们的应用程序商店应用程序(基于目标 c 语言)不会崩溃。

My only guess is that it's a glitch in UI_USER_INTERFACE_IDIOM() API implementation with some language specific coding (swift vs objective c) by Apple.

我唯一的猜测是,它是 UI_USER_INTERFACE_IDIOM() API 实现中的一个小故障,Apple 使用了某些特定于语言的编码(swift 与目标 c)。

Anyways, I would replace all UI_USER_INTERFACE_IDIOM() with UIDevice(). userInterfaceIdiom. I hope this helps someone!

无论如何,我会用 UIDevice() 替换所有 UI_USER_INTERFACE_IDIOM()。用户界面成语。我希望这可以帮助别人!