I’ve got a for loop that then passes the iterated object into a method with a byref param and get the following error:
Implicit conversion of an Objective-C pointer to 'FOO *__autoreleasing *' is disallowed with ARC
and warning:
Incompatible pointer types sending 'Foo *const __strong' to parameter of type 'Foo *__autoreleasing *'
The Loop:
for (Foo *obj in objArray) {
FooTableCell *newCell = [self createFooCellWithItem:obj];
}
The Method Signature:
-(FooTableCell *)createFooCellWithItem:(Foo **)newObj;
I’ve followed the suggestions at this SO q&a to no avail.
EDIT
Prepending a & before obj gives me the following error:
Sending 'Foo *const __strong *' to parameter of type 'Foo *__autoreleasing *' changes retain/release properties of pointer
As a resume of the discussion and findings in chat, here a couple of considerations.
It seems that you are trying to:
fast iterating over an array; while
replacing each array element within a method called from inside the loop;
this will not be allowed by the compiler. It would at least break the fast enumeration contract about not modifying the array within the enumeration.
My suggestion thus is specify explicitly an out-parameter in your
shouldAddObjectmethod, e.g.: