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

iOS: NSRunLoop on a Custom Cell

I am run NSRunLoop with NSTimer on a custom cell in order to continuously update the "Valid Until" UILabel. It works fine until I close the tableView, the NSRunLoop continues the time countdown. I use dealloc, but seems it doesn't drain NSRunLoop…
NCFUSN
  • 1,624
  • 4
  • 28
  • 44
0
votes
2 answers

When do NSLayoutConstrains work during app runs?

I set some NSLayoutConstrains in storyboard. I change a subview's frame in viewDidload, it doesn't work. I change it in viewWillAppear, it doesn't work. I change it in viewDidAppear, it works. So when I set up constrains in storyboard, when do that…
leizh00701
  • 1,893
  • 5
  • 21
  • 32
0
votes
1 answer

When Does NSTimer Fire If Main Thread Is Busy?

When does an NSTimer fire if the main thread is busy? Here is the line of code in question: [NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(onTimer:) …
Alex
  • 3,861
  • 5
  • 28
  • 44
0
votes
1 answer

Which thread to call CFRunLoopStop(CFRunLoopGetCurrent())?

I'm running CFRunLoopRun() in Thread A. To terminate the run loop, should I come back to Thread A to call CFRunLoopStop(CFRunLoopGetCurrent())? What happen if I call CFRunLoopStop(CFRunLoopGetCurrent()) in Thread B? If I'm in Thread B, how could I…
hackjutsu
  • 8,336
  • 13
  • 47
  • 87
0
votes
1 answer

Cocoa Run Loop Input Sources

I am writing an iPhone application, and I need to download files in the background. I can handle the download files part, but I am not so sure about the background part. My current idea is to use a run loop to wait until the user selects a file to…
InFreefall
  • 518
  • 1
  • 4
  • 16
0
votes
1 answer

Application's run loop slows down when receive/initiate a cellular call

I have a timer that fires a method in every 60ms of interval when the application is in foreground and fires in the same interval even if it is in background. When I initiate/receive a cellular call, the timer fires the method in every 120ms of…
PKN
  • 146
  • 4
0
votes
1 answer

"[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]" makes the UI non response

In the UIViewController viewDidAppear event, I want to get some data from web service. And the code like: - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; NSArray *arr = [self getCarList]; } - (NSArray *)getCarList { if…
bohan
  • 1,659
  • 3
  • 17
  • 29
0
votes
1 answer

How to use NSRunLoop and performSelector?

I'm trying to figure out how NSRunLoop works. So there are a few delayed tasks and I want to perform them in a few seconds using NSRunLoop. And I want to create NSRunLoop manually. How am I supposed to do this? NSRunLoop *loop = [NSRunLoop…
Tracy Jr.
  • 27
  • 4
0
votes
0 answers

iOS9 NSDefaultRunLoopMode does not listen to didRegisterForRemoteNotificationsWithDeviceToken delegate

In iOS 9 the [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:timeoutDate]; does not listen to didRegisterForRemoteNotificationsWithDeviceToken or didFailToRegisterForRemoteNotificationsWithError delegate, however it listens to…
0
votes
1 answer

iOS - NSRunLoop mainRunLoop use

- (void) myFunction { User *user = [[User alloc] init]; user.property = @"value"; [user login:@"username" password:@"pwd" delegate:nil]; while (NO == user.runLoopEnd) { [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode…
Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
0
votes
1 answer

Should a Bluetooth-communicating NSStream require a separate thread?

Using ExternalAccessory to talk to a Bluetooth device, I'm using the input and output NSStreams supplied by EASession to send messages to it. In Apple's EADemo example, it schedules both streams to the main thread's run loop. However, I have noticed…
Matoe
  • 2,742
  • 6
  • 33
  • 52
0
votes
2 answers

ios app design for a responsive UI

I am a newbie in ios app development and have a general question about the design of apps regarding the responsiveness of the user interface. Should there always be a separate thread to deal with the UI stuff ? For example I am working on a simple…
comatose
  • 1,952
  • 7
  • 26
  • 42
0
votes
1 answer

Why observer notifications for timer and input sources are delivered before those events actually occur in run loop sequence of events

I am learning how to use NSRunLoop and reading Apple Doc about Run Loops chapter. I am confused about some description about how the doc states about the the run loop sequence of events Because observer notifications for timer and input sources are…
llch
  • 129
  • 1
  • 3
  • 10
0
votes
1 answer

When setting up a timed execution using NSDate, NSTimer, and NSRunLoop, which one do I need to not release before the action in complete?

Here's the part of the code dealing with it: NSDate *fireDate = [NSDate dateWithTimeIntervalSinceNow:1.0+index]; NSTimer *timer = [[NSTimer alloc] initWithFireDate:fireDate interval:0.5 …
marty
  • 391
  • 1
  • 7
  • 15
0
votes
0 answers

How does the nested run loop?

How does the nested run loop? It turns each run loop runs the Independence of each other? or they are in sequence? I understand how CFRunLoopStop - stops the last nesting runloop?