Mac OS, console application. performSelector:withObject:afterDelay: doesn't work?

拟墨画扇 提交于 2019-12-02 08:36:13

Calls to -performSelector:withObject:afterDelay: require a run loop. Console applications do not, by default, pass control into the run loop ever. For more info, search for NSRunLoop.

From the docs:

This method registers with the runloop of its current context, and depends on that runloop being run on a regular basis to perform correctly.

You have no runloop. Ipso facto, this method does not perform correctly for you.

(Creating and starting a runloop is one of the things that calling UIApplicationMain does, but of course you are never calling it.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!