Does anyone know how can I set the argument of NSInvocation
to be nil
?
I am trying to use OCMock
and I would like this expectation to return nil. The problem is that I need to do something else when the method is called, as you can see in the example, that´s why I am not doing andReturn:nil
I want to do this:
[[[myObject stub] andDo:^(NSInvocation *inv) {
[inv setReturnValue:Nil];
[inv invoke];
[self notify:kXCTUnitWaitStatusSuccess]; //Code that I need to execute
}] myMethod:OCMOCK_ANY];
But I get an error:
*** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[NSInvocation setArgument:atIndex:]:
NULL address argument'
Anyone knows if there is another way to set that to nil? or if it is imposible?