xcode 核心数据属性类型列表?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10546632/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:17:05  来源:igfitidea点击:

List of Core Data attribute types?

iphoneobjective-cxcodecore-dataattributes

提问by iWizard

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

我搜索了 Core Data 属性类型,但没有成功。

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

当我打开我的实体和属性时,有几种类型:

  1. Integer
  2. Double
  3. String
  4. Boolean
  1. 整数
  2. 双倍的
  3. 细绳
  4. 布尔值

etc.

等等。

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

我很感兴趣,如果有一些 Apple 页面解释了每个属性的使用类型。

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?

例如,我需要一个属性类型,我将在其中保存大约 1000 个字符的字符串。对于这种类型的插入,我使用哪种属性类型?

Thanks for help

感谢帮助

回答by trojanfoe

The NSAttributeDescriptionclass referenceconstants section gives:

NSAttributeDescription类引用常数部分提供:

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;

回答by CrimsonDiego

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

未定义/瞬态、短整数、长整数、浮点数、双精度数、NSDecimalNumber、NSString、布尔值、NSDate、NSData、值转换器和 id