BTW: This mostly is in reference to iOS 6+:
I have an app that -- from many different places in the app -- performs a function that can be backgrounded safely, and is thread safe. I do not wish to stop the system while this function takes place, so instead of calling it as: [self functionName];
currently I fire off a NSTimer with a short short interval:
[NSTimer scheduledTimerWithTimeInterval:.5 target:self selector:@selector(doThis:) userInfo:@"someString" repeats:NO];
My question is this: I have begun to investigate NSNotification for this simply because I hate the idea of timers... they seem queued and do not let the system decide (in my opinion) which order to do them in. FIFO with most of them...or -- indeed -- all at the same time. You never know. So, in comes NSNotification:
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"doThis" object:nil userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"a",@"varA",@"b",@"varB",nil]];
Now, which is better for the system...resource-wise and, really, all around? NSTimer or NSNotification?
Obviously the nice thing of NSNotification is that once defined in the appDelegate -- can be called from any aspect of the app. NSTimer would be able to do that but it would require the requisite "target"...a few extra lines of looking up the target, etc.
Suggestions?