Top "Objective-c-blocks" questions

Blocks are Apple’s implementation of closures for C, which are also available for Objective-C and C++.

How to write an Objective-C Completion Block

I'm in a situation where need to call a class method from my view controller, have it do it's thing, …

ios objective-c objective-c-blocks
Custom completion block for my own method

I have just discovered completion blocks: completion:^(BOOL finished){ }]; What do I need to do to have my own method …

objective-c objective-c-blocks
When to use enumerateObjectsUsingBlock vs. for

Besides the obvious differences: Use enumerateObjectsUsingBlock when you need both the index and the object Don't use enumerateObjectsUsingBlock when you …

objective-c multithreading ios4 objective-c-blocks
Retain cycle on `self` with blocks

I'm afraid this question is pretty basic, but I think it's relevant to a lot of Objective-C programmers who are …

objective-c memory-management objective-c-blocks
Objective-C callback handler

I have a callback method that I got to work, but I want to know how to pass values to …

objective-c ios methods callback objective-c-blocks
dispatch_sync vs. dispatch_async on main queue

Bear with me, this is going to take some explaining. I have a function that looks like the one below. …

objective-c cocoa core-data grand-central-dispatch objective-c-blocks
Alternatives to dispatch_get_current_queue() for completion blocks in iOS 6?

I have a method that accepts a block and a completion block. The first block should run in the background, …

objective-c cocoa-touch ios6 objective-c-blocks grand-central-dispatch
Calling [self methodName] from inside a block?

I've just run into blocks and I think they are just what I'm looking for, except for one thing: is …

objective-c self objective-c-blocks
Implementing a method taking a block to use as callback

I would like to write a method similar to this: +(void)myMethodWithView:(UIView *)exampleView completion:(void (^)(BOOL finished))completion; I've …

objective-c ios callback objective-c-blocks
Can AFNetworking return data synchronously (inside a block)?

I have a function using AFJSONRequestOperation, and I wish to return the result only after success. Could you point me …

ios objective-c-blocks synchronous afnetworking