gpt4 book ai didi

ios - 0x8badf00d 在后台获取监听位置后崩溃

转载 作者:行者123 更新时间:2023-12-02 08:59:30 29 4
gpt4 key购买 nike

在我的 ios 应用程序中,当我收到后台获取执行时,我开始在后台监听用户的位置更新一段时间(最多 15 分钟)。但是,在我停止更新后,应用程序崩溃并出现 0x8badf00d 错误。

我已启用后台位置和后台获取权限,并且还在 CLLocationManager 上启用了后台位置更新。

知道为什么会发生此错误吗?

最佳答案

问题不在于它没有在后台运行,而在于正在运行的任何内容都阻塞了主线程。

0x8badf00d(“吃了不好的食物”;哈哈)表示看门狗进程(监视死亡/阻塞的进程)杀死了您的应用程序,通常是因为您做了一些事情来阻塞主线程。如果避免阻塞主线程,这个错误应该会消失。请参阅Technical Note 2151: Understanding and Analyzing Application Crash Reports并搜索0x8badf00d

正如它所说:

The exception code 0x8badf00d indicates that an application has been terminated by iOS because a watchdog timeout occurred. The application took too long to launch, terminate, or respond to system events. One common cause of this is doing synchronous networking on the main thread. Whatever operation is on Thread 0 needs to be moved to a background thread, or processed differently, so that it does not block the main thread.

他们专注于同步网络请求,但它可能是任何阻塞主线程太长时间的事情,无论是缓慢的同步进程还是死锁或其他什么。您应该查看线程 0 的堆栈跟踪,看看是否可以确定是什么阻塞了主线程。不过,这里还不足以让我们诊断它。

常见的罪魁祸首包括同步网络调用、同步 GCD 调用、信号量、锁或调度组“等待”调用的不当使用、死锁等。

关于ios - 0x8badf00d 在后台获取监听位置后崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46655106/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com