我应该只从主线程调用NSSavePanel runModal方法吗? [英] Should I call NSSavePanel runModal method only from main thread?

查看:62
本文介绍了我应该只从主线程调用NSSavePanel runModal方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很奇怪,尽管很少见,但是我的应用程序崩溃了.

I have weird, though rare, crashes in my application.

我怀疑是因为在与主线程不同的线程中调用了 NSSavePanel runModal .

I suspect that it happens because runModal of NSSavePanel is called in a thread different from the main thread.

我是否纠正了崩溃的原因?

Am I correct that it might be the cause for the crashes?

推荐答案

是.

我在错误的线程上调用 runModal 时崩溃了. performSelectorOnMainThread 通常可用于解决此问题.

I've had crashes calling runModal on the wrong thread. performSelectorOnMainThread is often useful to fix this.

这篇关于我应该只从主线程调用NSSavePanel runModal方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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