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
0
votes
1 answer

NSThread, AsyncSocket and object deallocation

I have a piece of network code that uses AsyncSocket but moves it to a separate runloop. I'm creating this runloop with the following piece of code: [NSThread detachNewThreadSelector:@selector(_workerLoop) toTarget:self withObject:nil]; and here's…
esad
  • 2,660
  • 1
  • 27
  • 23
0
votes
3 answers

Run loop doesn't proceed events

I'm testing with run loops in standard (created by XCode) App. My App has 2 buttons: Start Loop - starts runloop in some mode (see code below); Stop Loop - change self.stop flag to stop runloop. ` - (IBAction)stopLoop:(id)sender { self.stop =…
Lexandr
  • 679
  • 1
  • 6
  • 22
0
votes
2 answers

Need explanation for an excerpt from Apple's documentation on NSRunLoop

Apple's official documentation is sometimes difficult for understanding, especially for non-native speakers. This is an excerpt from Anatomy of NSRunLoop A run loop is very much like its name sounds. It is a loop your thread enters and uses to run…
Andrey Chernukha
  • 21,488
  • 17
  • 97
  • 161
0
votes
1 answer

Using "while loop" or "for loop" to drives NSRunLoop in a thread

I have some question about how to using NSRunLoop in a thread. In apple's Threading Programming Guide, it mention "that Your code provides the control statements used to implement the actual loop portion of the run loop—in other words, your code…
Qing
  • 313
  • 4
  • 15
0
votes
0 answers

Command line tool not terminating after adding a timer

Im writing a little command line tool that use AFHTTPNetworkng to pull some data from a server and display it. However because AFHTTPNetwotking uses an asynchronous call back, the application exits prior to getting the response from the server. I…
geminiCoder
  • 2,918
  • 2
  • 29
  • 50
0
votes
1 answer

NSURLConnection on mainRunloop not working

I got this problem with NSURLConnection instances, that after using an arbitrary number of them, they stop working and never call their delegate's methods. The way they are put to work is the following: [[NSRunLoop mainRunLoop] addPort:self.port…
Fran Sevillano
  • 8,103
  • 4
  • 31
  • 45
0
votes
4 answers

How would I go about running NSTimer while still allowing console input from the user?

Long story short, I'm trying to create a simple console game that allows the user to input commands into the console in order to perform actions (such as start/stop) while at the same time printing out various properties and actions into the…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
0
votes
2 answers

NSURLConnection making Asynch call a Synch and handle self signed certificate

I am trying to make a Asynchronous Call , a Synchronous one. I know its not a better idea to do it. But, I do need such to code to handle Auth Challenge of Self Signed Certificate while Keeping the call still as Synchronous. But, I am not sure…
NNikN
  • 3,720
  • 6
  • 44
  • 86
0
votes
1 answer

Cocoa - NSTimer initWithFireDate: multiple seconds too late?

I have a simple app that doesn't do much more (at the moment) than create a timer: _time = [[NSTimer alloc] initWithFireDate: _nextDate interval: 0.0f target: self …
user429620
0
votes
0 answers

iOS , AFURLConnectionOperation

i using this code but sometimes i have a received Exc bad access here is the code : - (void)operationDidStart { [self.lock lock]; if (! [self isCancelled]) { self.connection = [[NSURLConnection alloc] initWithRequest:self.request…
user2296278
  • 528
  • 1
  • 4
  • 17
0
votes
1 answer

app freezes, not device hang. In game using cocos2d

I'm using XCode 5. I'm making a game using Cocos2D. And want some functions to do repeatedly in sequence and one after another. Due to many actions performed at a time, so wants a delay too (by which no action is interfered by the next one and not…
eagle
  • 567
  • 1
  • 6
  • 24
0
votes
1 answer

iOS Downloading image in background and updating the UI

I am trying update an imageview with new image for every 1 sec by downloading the image from the server. The downloading happens in background thread. Below shown is the code NSTimer *timer = [NSTimer timerWithTimeInterval:0.5 …
Karthick
  • 382
  • 1
  • 3
  • 23
0
votes
1 answer

What is NSRunLoop?

I have been reading some documents about run loop, but still can not understand it exactly. As iOS is not open source, while NSRunLoop is special for iOS/Mac OS X platform, what is its real implementation inside?
Richard
  • 339
  • 3
  • 10
0
votes
3 answers

Is it possible for a delayed call to never get called in a thread?

Say you attach a timer to a runloop in a particular thread but the thread has exited before the timer gets triggered, causing the method to not be executed. Is this scenario possible?
Boon
  • 40,656
  • 60
  • 209
  • 315
0
votes
1 answer

python and Cocoa: about statusbar script

I am creating a little script which check the number of mail in my gmail account and print them in the status bar. The function gmail() returns the number of new emails. I have few questions, but first this is the code I wrote so far (clearly I am a…
mrw
  • 3
  • 1