相关疑难解决方法(0)

NSOperation和NSNotificationCenter在主线程上

我有一个NSOperation.完成后,我启动NSNotificationCenter让程序知道NS操作已完成并更新gui.

据我所知,NSNotification的监听器不会在主线程上运行,因为NSOperation不在主线程上.

当我触发事件时,如何才能使侦听器在主线程上运行?

[[NSNotificationCenter defaultCenter] postNotificationName:@"myEventName" object:self]; 
Run Code Online (Sandbox Code Playgroud)

iphone cocoa objective-c nsoperation nsnotificationcenter

19
推荐指数
4
解决办法
2万
查看次数