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 simplify callback logic with a Block?

Let's say I need to communicate with a class that provides a protocol and calls delegate methods when an operation …

objective-c cocoa objective-c-blocks
Simple GCD Serial Queue example like FIFO using blocks

I read Apple documentation on how to Use serial queues to ensure that tasks to execute in a predictable order …

ios objective-c-blocks grand-central-dispatch
How to remove elements in NSMutableArray or NSMutableDictionary during enumeration?

I am using block based enumeration similar to the following code: [[[rows objectForKey:self.company.coaTypeCode] objectForKey:statementType] enumerateObjectsWithOptions:NSEnumerationConcurrent …

objective-c ios nsmutablearray objective-c-blocks nsmutabledictionary
Grand Central Dispatch (GCD) with CoreData

I'm using Grand Central Dispatch (GCD) in my application to do some heavy lifting. The application is using Core-Data for …

iphone core-data objective-c-blocks grand-central-dispatch
How can I retrieve a return value from a completion block?

Is it possible to run a completion block on the main thread? For example, I have one method which returns …

iphone ios objective-c-blocks grand-central-dispatch
Why do nil / NULL blocks cause bus errors when run?

I started using blocks a lot and soon noticed that nil blocks cause bus errors: typedef void (^SimpleBlock)(void); SimpleBlock …

objective-c objective-c-blocks
How to call method on presenting view controller from modal view controller

I have a modal view controller that I called in from another view controller. Upon dismissal of the modal view …

ios objective-c-blocks modalviewcontroller presentmodalviewcontroller
Copying blocks (ie: copying them to instance variables) in Objective-C

I'm trying to understand blocks. I get how to use them normally, when passed directly to a method. I'm interested …

objective-c cocoa objective-c-blocks
Is it necessary to use weak references to self always inside blocks..?

I am getting confused with use of self inside blocks, I go through some of Apple's documents but still cannot …

cocoa-touch cocoa objective-c-blocks
Should I still copy/Block_copy the blocks under ARC?

I've just stumbled over the following SO topic: Why should we copy blocks rather than retain? which has the following …

objective-c automatic-ref-counting objective-c-blocks