Questions tagged [runloop]

A run loop is the concept of running a local loop waiting for a specific event or timeout.

A run loop is the concept of running a local loop waiting for a specific event or timeout.

Such a loop keeps the current thread busy and does not return until the loop has finished, which can either be by a timeout value, an explicit stop signal or if there are no events to process anymore (depends on the specific implementation). Message pumps/loops in applications to process incomming events are typical run loops. But there are other types of local loops (e.g. to make an originally asynchronous process synchronous).

126 questions
1
vote
1 answer

What is the difference between calling (NSRunLoop)-run() and CFRunLoopRun()

I am learning iOS runloop. Some articles on the net show me code like this: - (void)memoryIssue { for (int i = 0; i < 10000; i++) { NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(runThread) object:nil]; …
刘maxwell
  • 187
  • 10
1
vote
2 answers

NSTimer - set up plain vanilla -- doesn't fire

Compiling in XCode 3.1.1 for OSX 10.5.8 target, 32-bit and i386 build. I have a modal run loop, running in NSWindow wloop and NSView vloop. The modal loop is started first. It starts, runs and stops as expected. Here's the start: [NSApp…
fyngyrz
  • 2,458
  • 2
  • 36
  • 43
1
vote
1 answer

runloops and application:didFinishLaunch message order

My understanding of Runloops is basic so this may seem like a very trite question. I have the following in my application:didFinishLaunchingWithOptions (or applicationDidFinishLaunching): { // 1. typical app setup work: create various views, create…
Jonas Anderson
  • 1,987
  • 4
  • 24
  • 28
1
vote
1 answer

iOS Periodically perform a low-priority task while the system is idle

In the iOS App development process. I want to periodically perform a low priority task. And do not want this task will affect the main program of work. What is the way to achieve it? Now I use the timer to perform periodical task, but often find the…
S.Captain
  • 167
  • 1
  • 9
1
vote
2 answers

How to make a function been called every frame in the cocoa programming?

I know cocoa application has a main run loop, how to make a function been called every frame? I mean this function should be called every process of the main loop. Is that through the -(void) run of the + (NSRunLoop*) currentRunLoop;?
user577384
  • 11
  • 2
1
vote
1 answer

Runloop always cause XPC connection interrupted?

Hi I notice if I add runloop when app enter background will cause XPC connection interrupted for example , my app connection to a BLE device , if user is let the app enter background for a while , I will exit the app than release the connection Here…
Webber Lai
  • 2,014
  • 5
  • 35
  • 66
1
vote
1 answer

Creating custom run loop for real time event scheduling

I'm starting to dig into asynchronous code with Swift and Mac OS. I want to add a sequencer into my app, so I need a loop pretty much like SpriteKit's game loop runs, without the visual library. What I want to do is a virtual timeline that I can…
BadgerBadger
  • 696
  • 3
  • 12
1
vote
1 answer

trying SimplePing on iPhone, but the main runloop does not handle events from SimplePing

I need a simple pinger on the iPhone. So I try to get the SimplePing example running on iPhone. But when i init the pinger like in the example, the main runloop does not handle the events generated by SimplePing. Here is the initcode: -…
user542014
  • 11
  • 3
1
vote
2 answers

Uncaught exception in Firebase runloop (3.0.0) In my production Android app. Please report to support@firebase.com

I know there are already many issues in StackOverflow. But I didn't found any of these fixed my issue. My Android app is in production and I am getting this error almost everyday from my user. Fatal Exception: java.lang.RuntimeException: Uncaught…
Chandra Sekhar
  • 18,914
  • 16
  • 84
  • 125
1
vote
1 answer

When should we use run loop recursively in IOS?

I read the "IOS Developer Library" about the "Run Loops" theme, in the article, one sentence says "It is possible to run a run loop recursively". My question is in which scenario should use the recursive run loop please? My another question is about…
Jay
  • 113
  • 1
  • 11
1
vote
0 answers

how CFRunLoop Change the order of execution

- (void)viewDidLoad { [super viewDidLoad]; dispatch_async(dispatch_queue_create("oneQueue", DISPATCH_QUEUE_SERIAL), ^ { [self syncAction]; }); // CFRunLoopRun(); // 1 NSLog(@"mainQueue execut 1"); } -…
maquannene
  • 2,257
  • 1
  • 12
  • 10
1
vote
5 answers

iPhone - array lost between appDidBecomeActive: and run loop starting?

EDIT: I stuck in a single call to manually retain the array right after initializing it, and that fixed it. Dur. Thanks. I keep an NSMutableArray in a UIScrollView subclass, and I add to it instances of a UIImageView subclass as each is added as a…
Dan R.
  • 13
  • 1
  • 4
1
vote
1 answer

iPhone: how to prioritize items in a CFRunLoop (OpenGL related)

I have an OpenGL application which is rendering intensive and also fetches stuff over HTTP. Following Apple's samples for OpenGL, I originally used NSTimer for my main painting loop, before finding out (like everyone else) that it really isn't a…
lexh
1
vote
2 answers

Run loop on main thread in osx and ios

I can't find any reference on doing something that should be really basic: I'd like to have a method called "forever" on the main UI loop. I would be happy both with an way to call my method synced with the UI refresh rate, or by passing a custom…
1
vote
1 answer

How to set up an animation thread in iOS?

I have a function drawView which is thread safe and does drawing for short periods of game animation. I have functions startAnimating and stopAnimating. I want a background thread to call drawView at a regular rate but only during the period that…
Robotbugs
  • 4,307
  • 3
  • 22
  • 30
1 2 3
8 9