Objective-C callback handler [closed]

I’m not entirely sure what you’re trying to do there – your callback is a block… is that intentional? I would expect your method to look something like this: – (void)signInAccountWithUserName:(NSString *)userName password:(NSString *)password; If the intention of your callback is to execute some additional code (specified when you call the method) on completion, then … Read more

Better asynchronous control flow with Objective-C blocks

I created a light-weight solution for this. It’s called Sequencer and it’s up on github. It makes chaining API calls (or any other async code) easy and straightforward. Here’s an example of using AFNetworking with it: Sequencer *sequencer = [[Sequencer alloc] init]; [sequencer enqueueStep:^(id result, SequencerCompletion completion) { NSURL *url = [NSURL URLWithString:@”https://alpha-api.app.net/stream/0/posts/stream/global”]; NSURLRequest *request … Read more

How can I verify that I am running on a given GCD queue without using dispatch_get_current_queue()?

Assign whatever identifier you want using dispatch_queue_set_specific(). You can then check your identifier using dispatch_get_specific(). Remember that dispatch_get_specific() is nice because it’ll start at the current queue, and then walk up the target queues if the key isn’t set on the current one. This usually doesn’t matter, but can be useful in some cases.

tech