Running NSTimer Within an NSThread?

≡放荡痞女 提交于 2019-12-02 05:05:50

You're updating your UI in +startTime:, but that method does not run in the main thread. That may be the source of the WebCore warning you're seeing.

Off the cuff, the NSRunLoop you have in there seems a bit out of place. From the docs:

In general, your application does not need to either create or explicitly manage NSRunLoop objects. Each NSThread object, including the application’s main thread, has an NSRunLoop object automatically created for it as needed. If you need to access the current thread’s run loop, you do so with the class method currentRunLoop.

You have a timer, starting a thread, that gets the current run loop and tries to start running it. Do you want to associate the timer with that run loop?

Via a call to:

(void)addTimer:(NSTimer *)aTimer forMode:(NSString *)mode

?

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