解除视图控制器时出错 [英] Error when dismissing view controller

查看:139
本文介绍了解除视图控制器时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在解雇视图控制器时出现错误,之前没有看到类似的内容,而且在互联网上没有太多关于它。

Getting an error when dismissing a view controller, not seen anything like it before, and not much about it on the internet.

继承人错误:
* 断言失败 - [UIKeyboardTaskQueue waitUntilAllTask​​sAreFinished],/ SourceCache / UIKit / UIKit-2903.2 / Keyey / UIKeyboardTaskQueue.m:368

heres the error: * Assertion failure in -[UIKeyboardTaskQueue waitUntilAllTasksAreFinished], /SourceCache/UIKit/UIKit-2903.2/Keyboard/UIKeyboardTaskQueue.m:368

a一点背景,我保存一些数据后解除视图控制器。数据每次都成功保存。此外,我最近更改了日期保存代码以在这个方法的主线程上运行,因为我在后台保存了一些问题。

a bit of background, i dismiss the view controller after saving some data. the data saves successfully, every time. also, i recently changed the date saving code to run on the main thread for this one method, as i was having some issues saving in the background.

任何想法为什么这个正在发生什么?

any ideas why this is happening?

提前致谢。

推荐答案

我收到了这个在我不是主线程(来自网络请求中的回调)的线程上调用 -presentViewController:animated:completion:时出错。解决方案是将您的调用调用present和dismiss视图控制器发送到主线程:

I recieved this error when I was calling -presentViewController:animated:completion: on a thread that was not the main thread (from a callback in a network request). The solution is to dispatch your calls to present and dismiss view controllers to the main thread:

dispatch_async(dispatch_get_main_queue(), ^{
    //Code that presents or dismisses a view controller here
});

这篇关于解除视图控制器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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