When I try to print an integer value to the console that is retrieved from an NSManagedObject, it displays a 6 or 8 digit value (the object ID?). However, if I use the debug
NSInteger is just an int:
typedef int NSInteger;
In your first line of code:
NSInteger sequence = [[NSNumber numberWithInteger:(NSInteger)sequence] intValue];
All you are doing is assigning sequence to itself, in a round about way. And since it's not initialized, it might be any random number.