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?
You are passing an array of pointers in an ARC environment. You need to specify one of the following:
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];
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With