What does "Must explicitly describe intended ownership of an object array parameter" mean and how can I fix it?

iphone, objective-c

Solution

You are passing an array of pointers in an ARC environment. You need to specify one of the following:

- __strong

- __weak

- __unsafe_unretained

- __autoreleasing

I think in your case `__unsafe_unretained` should work, assuming that you do not do anything to the shapes that you pass to `draw()` concurrently.

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

Problem

There is something 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 fails with the error "Must explicitly describe intended ownership of an object array parameter". What is the exact cause of the error? How can I fix it?

Original source