I have an error with the sample code of my books

I have this code from a textbook tutorial:

 void drawShapes (id shapes[], int count)
 {
int i;

    for (i = 0; i < count; i++) {
id shape = shapes[i];
[shape draw];
 }

}

And Xcode tells me about the error: "Automatic reference counting error: should explicitly describe the alleged ownership of the parameter of the array of objects."

What am I doing wrong?

0
source share
3 answers

If you want to pass an automatically allocated array, change the function declaration to:

void drawShapes (id __autoreleasing shapes[], int count)

and that should take care of your mistake!

0
source

.
ARC Apple iOS5.0. iOS ARC.
ARC , NSArray, complier, ARC.

. .

1. :

void drawShapes (id __autoreleasing shapes[], int count)

, ARC C [].


2. , ARC

iOS, iOS, " " .

Mac OS ( iOS), , "Building Settings", " ", "NO".

0

[ ]; , . , [ ] []. , .

-2

All Articles