You need to box the value in an NSValue
instance, and not pass the primitive value itself. For example:
[[[mockLocationManager stub] andReturnValue:@(kCLAuthorizationStatusDenied)] authorizationStatus];
The above makes use of the Objective-C literal syntax for NSNumber
s. Also, I omitted the classMethod
call above CLLocationManager
doesn't have an instance method authorizationStatus
.
More support for this can be found on the the OCMock website:
If the method returns a primitive type then andReturnValue: must be used with a value argument. It is not possible to pass primitive types directly.
That's also what the compiler error is telling you - that you are passing an int
instead of an NSValue
instance.