I have an attribute called phoneNo in my Core Data model, an integer16, and I need to of course save and load the value.
So I try saving the number the user types into a text field:
[myObject setValue:[NSNumber numberWithInteger:[textField.text integerValue]] forKey:@"mobileNo"];
Then I try and display the value like so:
label.text = [myObject.mobileNo stringValue];
Lets say I type in 123456789; instead of displaying that, it shows -13035. I’m unsure if Im saving or loading wrongly, or both.
In your datamodel (yourapp.xcdatamodeld) the type of your attribute phoneNo shouldn’t be integer of 16 (from -32.768 to +32.768) which is not enough, it should be integer32 (-2.147.483.647 to +2.147.483.647) or integer64 if the guy type the country identifier like (+33) 1 23456789.