Questions tagged [nsrunloop]

NSRunLoop is a class in Apple's Foundation framework. It processes inputs such as user events, network activity, and NSTimer events.

NSRunLoop is a class in Apple's Foundation framework for OS X and iOS. It processes inputs such as user events, network activity, and NSTimer events. Each NSThread object automatically receives its own NSRunLoop; apps cannot explicitly create or manage NSRunLoop objects.

353 questions
3
votes
0 answers

NSRunLoop from a queue context does it make sense?

I've been trying to move away from targeting specific threads and thinking more about queues like suggested by best practices and guidelines in the iOS arena. WHAT I USED TO DO: I used to be able to create a new thread, then run a runloop on…
zumzum
  • 17,984
  • 26
  • 111
  • 172
3
votes
1 answer

NSProgressIndicator in NSMenuItem not updating on second display

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…
Frog
  • 1,631
  • 2
  • 17
  • 26
3
votes
1 answer

Calling NSURLConnection inside dispatch_async and reading didReceiveResponse in mainRunLoop in iPhone development

What I am trying to do is getting response for following method - (void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { } after calling this NSURLConnection *conn = [[NSURLConnection alloc]…
AnujAroshA
  • 4,623
  • 8
  • 56
  • 99
3
votes
2 answers

SocketRocket RunLoop sporadic crash

So our app has been experiencing crashes for a while in SocketRocket. We get about 20 crashes a day from it, with the following stack trace: Crashed: com.apple.root.default-overcommit-priority EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000c…
Erhannis
  • 4,256
  • 4
  • 34
  • 48
3
votes
2 answers

Does [UIApplication sendEvent:] execute in a NSRunLoop?

I read this apple doc about runloop: A run loop is an event processing loop that you use to schedule work and coordinate the receipt of incoming events... A run loop receives events from two different types of sources. Input sources deliver…
smilingpoplar
  • 1,065
  • 1
  • 15
  • 26
3
votes
0 answers

Where should I use nsrunloop?

I studied something about run loop. That It is event processing loop. The RunLoop is what keeps your app running until it should quit. It handles events, etc. And also it makes our thread busy when it has work otherwise make it sleep. But I can't…
jailani
  • 2,260
  • 2
  • 21
  • 45
3
votes
1 answer

How does RunLoop reduces CPU cycles

I have been reading about RunLoops for a few days in Apple documentation and stuff from Google search. I have understood the concept of RunLoops to great extent but still I got no answer to some basic questions regarding RunLoops. How Runloop…
tek3
  • 2,095
  • 2
  • 20
  • 50
3
votes
1 answer

"Block" main thread (dispatch_get_main_queue()) and (or not) run currentRunLoop periodically - what is the difference?

I have the following code: - (void)test_with_running_runLoop { dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); NSTimeInterval checkEveryInterval = 0.05; NSLog(@"Is main queue? : %d", dispatch_get_current_queue() ==…
Stanislav Pankevich
  • 11,044
  • 8
  • 69
  • 129
3
votes
1 answer

How to measure the draw time of a UIImageView?

I have been working on tracking down a performance issue in one of our apps. What seems to happen is that sometimes a UIImageView takes seconds to render an image and, because of the way the code is written, this blocks the main thread. I've tracked…
sujal
  • 1,595
  • 1
  • 13
  • 14
3
votes
1 answer

NSRunLoop is consuming a lot of cpu and memory

I have a infinite loop that drives my worker thread. -(void) myThread { NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init]; while(![myThread isCancelled]) { [[NSRunLoop currentRunLoop] runUntilDate:[NSDate…
Parag Bafna
  • 22,812
  • 8
  • 71
  • 144
2
votes
2 answers

NSRunLoop working OK on Simulator, Crashes iDevice

I'm working on an iOS App (FW: 5.0+ & ARC) which needs to update second by second. Currently, I have this within a method (which is called in a performSelector when -ViewDidLoad): -(void)FireOnload { counter = [NSTimer timerWithTimeInterval:1.0…
Moe
  • 4,744
  • 7
  • 28
  • 37
2
votes
1 answer

iOS: multiple NSTimer instances using the same view - do I need to use multithreading?

I'm working on a multiview app. One of the views is a table view. Each cell has a stopwatch. I'm planning to use NSTimer for the stopwatches. Do I need to implement multithreading for the timers to work properly even when the user switches the view…
2
votes
1 answer

NSURLConnection messes up iPad memory

we build an iPad app that downloads a bunch of data and PDF documents from a web service (data first, documents later in the background). To do so, we use SOAP via HTTP(S) requests. It works fine and altogether, the app is running well. Problem is,…
robbash
  • 985
  • 10
  • 21
2
votes
1 answer

NSTimer in sheet window not firing

I have a timer within a panel that I am trying to get to fire every second, however I cannot seem to get it to fire. I am creating my panel like so: // Begin our sheet [NSApp beginSheet: targetController.window modalForWindow: self.window …
Kyle
  • 17,317
  • 32
  • 140
  • 246
2
votes
0 answers

`cancelPerformSelectorsWithTarget:` vs `cancelPreviousPerformRequestsWithTarget:`

I am building a kind of simulation with ever-smaller intervals between "ticks": - (void) simulationTick { if (self.currentTick >= kNumberOfSimulationTicks) return; // recursion anchor // ... do stuff ... self.currentTick =…
Yang Meyer
  • 5,409
  • 5
  • 39
  • 51