Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We saw examples using integer variables. Next, let’s see what will happen when an object is used from a Block. In the next source code, an object of the NSMutableArray class is created and the assigned variable has ownership of it. Because the scope of the variable, which qualified with __strong, is left immediately, the object is released and discarded.
{
id array = [[NSMutableArray alloc] init];
}
Listing 5–7 uses the variable “array” in a Block literal.