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

How can we stop thread

I am developing application in which my thread is starting when connectionDidFinishLoading. - (void)connectionDidFinishLoading:(NSURLConnection *)connection { [downloadingthread cancel]; downloadingthread = [[NSThread…
Nitin
  • 7,455
  • 2
  • 32
  • 51
2
votes
1 answer

CADisplayLink in RunLoop not calling callback

I have the following code which should make drawFrame be called every frame but it doesn't: - (void)viewDidLoad { [super viewDidLoad]; displayLink = [viewReference.window.screen displayLinkWithTarget:(self) selector:@selector(drawFrame)]; …
Lars
  • 163
  • 4
  • 12
2
votes
4 answers

Stop performing the animation in background thread and run loop

I run my animations in a UITAbleViewCell. Each cell has its own animation and the cells are reusable. I use [mView performSelectorInBackground:@selector(layoutSubview) withObject:nil]; There in the background thread I initiate the runLoop to…
Oleg Danu
  • 4,149
  • 4
  • 29
  • 47
2
votes
1 answer

On NSRunLoop, clarification needed

When i Logger *logger = [Logger new]; NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; __unused NSURLConnection *conn = [[NSURLConnection alloc] …
James Raitsev
  • 92,517
  • 154
  • 335
  • 470
2
votes
0 answers

iOS 15 Beta 5(19A5318f) runloop run crash

After iOS 15 Beta 5(19A5318f) distribute,we find a new Crash (only based on Beta 5(19A5318f)) disappear. Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x00000004e12f03a0 Exception Codes: 0x0000000000000001,…
qing
  • 21
  • 3
2
votes
1 answer

Refresh a NSOpenGLView within a loop without letting go of the main runloop in Cocoa

I am building an Cocoa/OpenGL app, for periods of about 2 second at a time, I need to control every video frame as well as writing to a digital IO device. If after I make the openGL calls I let go of the main thread (like if I make the openGL calls…
Ali
  • 18,665
  • 21
  • 103
  • 138
2
votes
1 answer

iOS RunLoop and DispatchQueue.main.async

Why does the print("2") part never get called in the following code? I'd think that the inner main.async would push the block into the main loop's queue, and then RunLoop.run would execute it, but apparently that isn't what happens. (It prints 1,…
imre
  • 1,667
  • 1
  • 14
  • 28
2
votes
1 answer

Improper behavior of NSTimer on separate thread

I am trying to schedule NSTimer on a separate thread and this is how i am doing it. -(void) startSpinner { #ifdef DEBUG_MODE NSLog(@"Starting Spinner..."); #endif self.spinnerThread = [[[NSThread alloc] initWithTarget:self…
user745098
2
votes
1 answer

Getting accelerometer data from an iPhone, from a command-line program?

Please view the gist below: https://gist.github.com/969112 Essentially, I am trying to set up a UIAccelerometerDelegate and have it receive data from a command-line iPhone application (i.e. it's jailbroken, I'm ssh'd into the phone and compiling the…
TooTallNate
  • 1,477
  • 3
  • 20
  • 41
2
votes
2 answers

dispatch_after block is not running

Please consider this simple example: - (void)viewDidLoad { [super viewDidLoad]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW,…
2
votes
1 answer

Correct usage of secondary NSThread with NSRunLoop

I have a performance-sensitive code, working with frames of video-playback in real time. I have some work here which can be parallelised and since it's a performance-sensitive code where latency is the key I decided to go with NSThread instead of…
Eugene Alexeev
  • 1,152
  • 12
  • 32
2
votes
0 answers

Why is my Timer selector firing twice (RunLoop)?

I inherited some code for use in detection of end of speech. ... recognitionRequest.shouldReportPartialResults = true recognitionTask = speechRecognizer.recognitionTask(with: recognitionRequest, resultHandler: { (result, error) in if result !=…
2
votes
1 answer

secondary thread regarding

I have a main and an auxiliary thread in my app. Main thread as everyone knows is being used by UI. I use the secondary thread to do the background loading of my views. I have a main controller which i call a dummy controller. From there i call my…
swapnil
  • 43
  • 6
2
votes
1 answer

Why a NSTimer can be delayed in background mode?

My app run in background and uses NSTimer to launch audio after a certain amount of time. Me and my testers have no problems with this, and audio can be launched event after several hours in the background (>10h). My issue is that some users reports…
OthmanT
  • 223
  • 3
  • 13
2
votes
1 answer

Unit Test with NSUndoManager, Runloop - Obj-C

I'm trying to test some code with an undo manager, but apparently, undo's get grouped when run in the same run loop. I have tried turning off groupsByEvent, but it doesn't work as expected. - (NSString *)article { return _article == nil ? @"no…
Chris
  • 2,739
  • 4
  • 29
  • 57