I have an iOS app that's using RestKit to pull data from our server-side API in JSON format. I've been working on it for about a year, and I've not seen this happen before - for some reason RestKit appears to be mapping the ID 1047470 as -1106.
It looks like it could be an error code perhaps, but I have no idea why it would show up as a mapped value, instead of an actual error. Other IDs being mapped work fine, as do all other IDs (as far as I can tell) across the many other entities we're using.
An excerpt from the object mapping debug log is below. (I'm not mapping some of the values yet as they're unneeded at this point.)
2015-10-21 10:27:50.577 App[13381:9422581] D restkit.object_mapping:RKMapperOperation.m:327 Found mappable collection at keyPath 'members': (
{
accountName = "Test Account Name";
memberEmail = "test##test.com";
memberFirstName = TestFirst;
memberId = 1047470;
memberLastName = "TestLast";
planId = 1;
smsConfirm = 0;
}
)
2015-10-21 10:27:50.578 App[13381:9422581] D restkit.object_mapping:RKMapperOperation.m:251 Asked to map source object {
accountName = "Test Account Name";
memberEmail = "test##test.com";
memberFirstName = TestFirst;
memberId = 1047470;
memberLastName = "TestLast";
planId = 1;
smsConfirm = 0;
} with mapping <RKEntityMapping:0x7ff3c86eaf10 objectClass=Member propertyMappings=(
"<RKAttributeMapping: 0x7ff3c86eb360 memberId => memberId>",
"<RKAttributeMapping: 0x7ff3c86ebd10 smsConfirm => smsConfirm>",
"<RKAttributeMapping: 0x7ff3c86eca20 planId => planId>"
)>
2015-10-21 10:27:50.578 App[13381:9422581] D restkit.object_mapping:RKMappingOperation.m:1159 Starting mapping operation...
2015-10-21 10:27:50.579 App[13381:9422581] D restkit.object_mapping:RKMappingOperation.m:1244 Finished mapping operation successfully...
2015-10-21 10:27:50.584 App[13381:9422581] D restkit.object_mapping:RKMapperOperation.m:433 Finished performing object mapping. Results: {
members = (
"<Member: 0x7ff3cd542a90> (entity: Member; id: 0x7ff3d3bd1ab0 <x-coredata:///Member/tC7917ADF-B44F-481D-BF96-F4F4C03B18AF3> ; data: {\n memberId = \"-1106\";\n planId = 1;\n smsConfirm = 0;\n})"
);
}
Anyone know why this might be happening?
Solved my own question - total schoolboy error. memberId
was an Integer 16, which means that 1047470 was too big for it. I've changed to Integer 32, and it works fine. Rookie.