Something is wrong with the first line of the following function definition:
void draw(id shapes[], int count) { for(int i = 0;i < count;i++) { id shape = shapes[i]; [shape draw]; } }
Compilation failed with the error "Must explicitly describe the alleged ownership of an object array parameter."
What is the specific cause of the error? How can i fix this?
You are passing an array of pointers in an ARC environment . You must specify one of the following values:
I think that in your case it __unsafe_unretainedshould work, assuming that you are not doing anything with the forms that you go through at the draw()same time.
__unsafe_unretained
draw()
void draw(__unsafe_unretained id shapes[], int count) { for(int i = 0;i < count;i++) { id shape = shapes[i]; [shape draw]; } }
, , , , __unsafe_unretained, , , Strong var unsafe_unretained. __strong .
void draw(__strong id shapes[], int count) { for(int i = 0;i < count;i++) { id shape = shapes[i]; [shape draw]; } }
- ARC Xcode.
, LLVM Apple 8.1 - Objective-C . .