I have a method of the followng signature;
- (NSInteger) getFirstVisitTimeStamp;
When I use OCMock to mock and return a value, the test fails with the below error.
[[[[YSNYI13NMockingTest mockedYI13N] expect] andReturnValue:@(12345)] getFirstVisitTimeStamp];
Error:
file:///%3Cunknown%3E: test failure:
failed: Return value does not match method signature; signature declares 'q' but value is 'i'.
Can anyone help ?
On 64-bit devices, NSInteger
is declared as long
, but the value you are returning is being typed as int
. Try forcing your value to a long by adding l
after the number:
[[[[YSNYI13NMockingTest mockedYI13N] expect] andReturnValue:@(12345l)] getFirstVisitTimeStamp];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With