OCMock expect and return gives signature error

ios, objective-c, ocmock

Solution

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];

Problem

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 ?

Original source