6
votes

I've searched Core Data attribute types but with no success.

When I open my Entity and Attribute there are several types:

  1. Integer
  2. Double
  3. String
  4. Boolean

etc.

I'm interested if there is some Apple page which explains about every attribute for which type of usage is.

For example I need an attribute type in which I'll be saving strings of about 1000 characters. Which attribute type do I use for this type of insert?

Thanks for help

2

2 Answers

9
votes

The NSAttributeDescription class reference constants section gives:

typedef enum {
NSUndefinedAttributeType = 0,
NSInteger16AttributeType = 100,
NSInteger32AttributeType = 200,
NSInteger64AttributeType = 300,
NSDecimalAttributeType = 400,
NSDoubleAttributeType = 500,
NSFloatAttributeType = 600,
NSStringAttributeType = 700,
NSBooleanAttributeType = 800,
NSDateAttributeType = 900,
NSBinaryDataAttributeType = 1000,
NSTransformableAttributeType = 1800,
NSObjectIDAttributeType = 2000
} NSAttributeType;
4
votes

You can find the list here, specifically described in the constants section.

Specifically, typedef enum {
NSUndefinedAttributeType = 0,
NSInteger16AttributeType = 100,
NSInteger32AttributeType = 200,
NSInteger64AttributeType = 300,
NSDecimalAttributeType = 400,
NSDoubleAttributeType = 500,
NSFloatAttributeType = 600,
NSStringAttributeType = 700,
NSBooleanAttributeType = 800,
NSDateAttributeType = 900,
NSBinaryDataAttributeType = 1000,
NSTransformableAttributeType = 1800,
NSObjectIDAttributeType = 2000
} NSAttributeType;

This means the types available to you are:

Undefined/transient, short, integer, long, float, double, NSDecimalNumber, NSString, Boolean, NSDate, NSData, Value transformers, and id