Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OCMock Argument Match on Double Pointer

For a selector like this:

-(void) callFoo:(NSError**)error;

How can I get an expectation like the below to work? ARC is not liking this kind of expectation, and I don't want to disable ARC for the entire unit test file!

[[mockObject expect] callFoo:[OCMArg anyPointer]];
like image 991
Ray Avatar asked Jul 13 '26 21:07

Ray


1 Answers

anyPointer returns void *, but under ARC, double pointers to Objective-C objects are implicitly qualified with __autoreleasing.

Try changing it to:

[[mockObject expect] callFoo:(NSError * __autoreleasing *)[OCMArg anyPointer]];
like image 168
Christopher Pickslay Avatar answered Jul 15 '26 12:07

Christopher Pickslay