我搜索了Core Data屬性類型,但沒有成功。核心數據屬性類型列表?
當我打開我的實體和屬性有以下幾種類型:
- 整數
- 雙
- 字符串
- 布爾
等
我有興趣的話,如果有一些Apple頁面哪個解釋關於哪種使用類型的每個屬性。
例如我需要一個屬性類型,其中我將保存大約1000個字符的字符串。這種插入類型使用哪種屬性類型?
感謝您的幫助
我搜索了Core Data屬性類型,但沒有成功。核心數據屬性類型列表?
當我打開我的實體和屬性有以下幾種類型:
等
我有興趣的話,如果有一些Apple頁面哪個解釋關於哪種使用類型的每個屬性。
例如我需要一個屬性類型,其中我將保存大約1000個字符的字符串。這種插入類型使用哪種屬性類型?
感謝您的幫助
的NSAttributeDescription
class reference常數部分提供:
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;
你可以找到名單here,在常量節具體描述。
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;
這意味着您可以使用的類型有:
未定義/短暫,短,整型,長,浮動,雙,NSDecimalNumber,的NSString,布爾,NSDate的,NSData的,價值變壓器,和id
是否有任何鏈接解釋有多少個字符適用於例如屬性串? – CroiOS
@CroiOs - 它是無限的 - 請參閱sqlite [文檔](http://sqlite.org/faq.html#q9)。 –
你能告訴我有多少字符適合一個位?現在我知道我應該使用屬性類型字符串插入1000個字符的字符串。 – CroiOS
@CroiOS使用'NSStringAttributeType'看起來是存儲1000個字符的正確選擇。任何對每個值大小的限制都可能取決於底層的存儲機制。 – trojanfoe
你能告訴我在1位中有多少字符? (1個字符?) – CroiOS