item.itemId is in coredata as an NSNumber and itemModel.itemID is a NSInteger. When saving itemModel.itemId to the itemId in core data it prints out -31016 for item.ItemID and 100056 for the NSInteger.
The following two lines prints out -31016 100056.
item.itemId = [NSNumber numberWithInteger:itemModel.itemId];
NSLog(@"%@ %ld",item.itemId,(long)itemModel.itemId);
ItemId is model i've created and itemId is declared like this.
@property (assign, nonatomic) NSInteger itemId
The value for itemID is set like this coming from the server as an integer.
self.itemId = [attributes[@"Id"] integerValue];
Your Core Data attribute is problaby defined as Integer 16
. In that case, all values
stored in the Core Data object are (silently) truncated to 16-bit. In your example:
100056 = 0x186D8
is truncated to
-31016 = 0x86D8
Changing the attribute to Integer 32
or Integer 64
should solve the problem.