nsrunloop

Diagnosing run loop issue (partially frozen UI) in Cocoa application

纵饮孤独 提交于 2020-01-05 00:44:32
问题 Our application has a fairly standard layout - a main window with a toolbar, source list on the left hand side, and a tab control. The contents of the tabs is drawn by a third party component that is open source and very complex. It makes extensive use of threads, etc. Some users can reliably reproduce a situation where the whole application 'freezes' - which is to say, the main window stops redrawing. The cursor does not beachball, and the user can still click around, but the window simply

Diagnosing run loop issue (partially frozen UI) in Cocoa application

馋奶兔 提交于 2020-01-05 00:41:22
问题 Our application has a fairly standard layout - a main window with a toolbar, source list on the left hand side, and a tab control. The contents of the tabs is drawn by a third party component that is open source and very complex. It makes extensive use of threads, etc. Some users can reliably reproduce a situation where the whole application 'freezes' - which is to say, the main window stops redrawing. The cursor does not beachball, and the user can still click around, but the window simply

Diagnosing run loop issue (partially frozen UI) in Cocoa application

亡梦爱人 提交于 2020-01-05 00:40:08
问题 Our application has a fairly standard layout - a main window with a toolbar, source list on the left hand side, and a tab control. The contents of the tabs is drawn by a third party component that is open source and very complex. It makes extensive use of threads, etc. Some users can reliably reproduce a situation where the whole application 'freezes' - which is to say, the main window stops redrawing. The cursor does not beachball, and the user can still click around, but the window simply

App stops receiving data from socket when UI scroll

僤鯓⒐⒋嵵緔 提交于 2020-01-04 04:34:47
问题 I have an iPad app that receives data using UDP sockets. And it has a UIWebView to browse webpages. But while doing scroll in the UIWebView, everything freezes and no data is received. I've been searching and it has something to do with runloops and threads. But if the UIWebView can't run in another thread other than the main one, how can I receive data while doing scroll? It is critical to keep receiving data. The project uses the AsyncUdpSocket class from Cocoa AsyncSocket that works quite

NSRunLoop freezes with NSTimer and any input

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-03 02:30:06
问题 For some reason when I push down (click and hold) on any control, the NSTimer in my App freezes and does not fire until I release the mouse button. It simply does not fire while I have the mouse pressed. This is fine for short periods, but it also freezes if I have a popup menu open, or a combobox dropped down. I'm not sure if there is something I missed, but it seems like this is incorrect behavior. I want to be able to click the down arrow of an NSPopUpButtonCell (or even click and hold an

Checking if NSTimer was added to NSRunLoop

こ雲淡風輕ζ 提交于 2019-12-31 02:59:08
问题 Let's say I'm creating NSTimer in some place in the code and later, I want to add it to the mainRunLoop only if it wasn't already added before: NSTimer* myTimer = [NSTimer timerWithTimeInterval:1.0f target:self selector:@selector(targetMethod:) userInfo:nil repeats:YES]; Another place in the code: if("my myTimer wasn't added to the mainRunLoop") { NSRunLoop *runLoop = [NSRunLoop mainRunLoop]; [runLoop addTimer:myTimer forMode:NSDefaultRunLoopMode]; } Is there a way to check this? 回答1: Try

NSProgressIndicator in NSMenuItem not updating on second display

混江龙づ霸主 提交于 2019-12-31 02:29:09
问题 I've got a NSMenu attached to a NSStatusItem (a menu bar application). While downloading a file I want to display a NSProgressIndicator in an item of this menu. I've created a NSViewController subclass for this progress indicator with the following properties: @property NSUInteger current; // Bound to NSProgressIndicator value @property NSString *status; // Bound to a NSTextField value @property NSUInteger total; // Bound to NSProgressIndicator max value When needed I start the download of

Main Thread Runloop gets blocked on opening nsmenu

筅森魡賤 提交于 2019-12-31 01:41:27
问题 I have an application for which the UI element includes an NSStatusItem and a menu. Inside my application , I am using NSTask asynchronously to perform some operation and I am using the output obtained using the NSFileHandleReadCompletionNotification to update the menu. But now whenever I click and open the menu , the main runloop goes into NSEventTrackingRunLoopMode and the notification posting fails. So basically with my menu open , no operation takes place on the main thread. Now I found a

Run repeating NSTimer with GCD?

北城以北 提交于 2019-12-28 05:10:16
问题 I was wondering why when you create a repeating timer in a GCD block it doesen't work? This works fine: -(void)viewDidLoad{ [super viewDidLoad]; [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(runTimer) userInfo:nil repeats:YES]; } -(void)runTimer{ NSLog(@"hi"); } But this doesent work: dispatch_queue_t myQueue; -(void)viewDidLoad{ [super viewDidLoad]; myQueue = dispatch_queue_create("someDescription", NULL); dispatch_async(myQueue, ^{ [NSTimer

UIPickerView “preemptive” messages?

ぃ、小莉子 提交于 2019-12-25 06:58:40
问题 I have a situation where my UIPickerView is getting "starved" by a computation task; in other words, the UIPickerView is never updated -- and hence, never sends messages -- because a very heavy compute task is happening. The picker controls aspects of the computation, so the two have to play nice. I thought of running the computation in a separate thread. Seems like that would leave the picker free to update. However, it'd be a massive undertaking to make my computation multithread-able, so I