views:

121

answers:

1

The Xcode data modeler shows me those three different int data types. When I would write code, which data types do these really correspond to on the iPhone? Are they all simply NSInteger, wrapped in an NSNumber?

As far as I see it, NSNumber only differentiates between int an NSInteger... so I guess those three end up beeing pretty much the same?

+2  A: 

Those values correspond to the NSAttributeType of NSAttributeDescription. These are analogous to the strings returned by NSValue's objCType method inherited by NSNumber. The core data framework needs to know how to encode/decode the value in the persistent store and also which init method to call when creating the NSNumber object. The types in NSEntityDescription provide the ability to dynamically create the correct object from storage and save them again. Generally, you don't need to be concerned with the storage details of the NSValue classes and subclasses. These details are hidden on purpose. If you were implementing your own custom NSAtomicStore then you will need to know. Consult the Atomic Store Programming Topics for further details.

falconcreek
So if I shouldn't care about the details, why must I choose between one of three int types? ;) Couldn't they just provide one "int" option? Or, lets say, if I choose int64...is that something like long long?
dontWatchMyProfile
When dealing with the NSNumber object, you don't need to know, however if you are pulling values from remote data sources to create new ManagedObjects, you will have to match the storage type with the remote type to avoid overflow conditions or loss of precision.
falconcreek