问题
Is it correct to say that property list files (.plist) only handle NSString
, NSNumber
, NSDate
and NSData
(allowing to store any other type which conforms to NSCoder
) + NSArray
/ NSDictionary
of those types?
回答1:
Yep, that is pretty much the exact definition of a property list. Wikipedia has a little table that explains how each class will be stored in the resulting XML file:
Foundation class XML Tag Storage format
NSString <string> UTF-8 encoded string
NSNumber <real>, <integer> Decimal string
NSNumber <true />, or <false /> No data (tag only)
NSDate <date> ISO 8601 formatted string
NSData <data> Base64 encoded data
NSArray <array> Can contain any number of child elements
NSDictionary <dict> Alternating <key> tags and plist element tags
回答2:
Property List can only contains following types of data:
NSString NSNumber NSNumber NSDate NSData NSArray NSDictionary
for more information visit: Property List Format or visit Apple Docs
You can also save other objects as NSData by serializing them
来源:https://stackoverflow.com/questions/13295517/property-list-supported-objc-types