Top "Objective-c-blocks" questions

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

What is the difference between a __weak and a __block reference?

I'm reading Xcode's documentation, and here is something that puzzles me: __block typeof(self) tmpSelf = self; [self methodThatTakesABlock:^ { [tmpSelf doSomething]; }]; …

objective-c memory-management objective-c-blocks weak-references ownership
Generic typeof for weak self references

I am trying to figure out a way to use typeof to create a weak reference to self for use …

objective-c cocoa automatic-ref-counting objective-c-blocks weak-references
iOS blocks and strong/weak references to self

I have a question about strong and weak references to self in blocks in iOS. I know the proper way …

ios objective-c objective-c-blocks
Difference between block (Objective-C) and closure (Swift) in iOS

In tutorials it's written that functionally both are same even closure is more easier then block and its avoided the …

ios objective-c swift closures objective-c-blocks
How to dispatch on main queue synchronously without a deadlock?

I need to dispatch a block on the main queue, synchronously. I don’t know if I’m currently running …

objective-c ios objective-c-blocks grand-central-dispatch
Block references as instance vars in Objective-C

I was wondering if it's possible to store a reference to an anonymous function (block) as an instance variable in …

objective-c objective-c-blocks
FIFO serial queue using GCD

I am trying to create a (network) synchronized array for the company I work for. While the networking part works …

objective-c objective-c-blocks grand-central-dispatch fifo
iOS autorelease pool blocks

I was reading the documentation from apple about memory management when I got to autorelease pool blocks and something got …

ios memory-management objective-c-blocks autorelease nsautoreleasepool
Using __block and __weak

I've read over this thread: What does the "__block" keyword mean? which discusses what __block is used for but I'm …

objective-c objective-c-blocks weak-references
setKeepAliveTimeout and BackgroundTasks

I've a big headache with the topic. I'm working on an application that needs to poll a webserver regularly, in …

iphone objective-c nsurlconnection nsthread objective-c-blocks