Yes. Under ARC, it is incorrect to use
id myObject = nil; // or any object type or block type
[invocation getArgument:&myObject atIndex:index];
because &myObject
is type id __strong *
, i.e. pointer to strong reference. Whoever assigns to the strong reference pointed to by this pointer must take care to release the previous value and retain the new value. However, getArgument:atIndex:
does not do that.
You are right. The two correct ways to do it you have already found: 1) do it with void *
and then assign it back into object pointer, or 2) do it with __unsafe_unretained
object pointer.