Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A plist by definition contains any of the following types: array, dictionary, string, real, integer, boolean, date and data). If you are using a true plist you can instantiate the objects it contains with a single line of code. See the NSPropertyListSerialization method:</p> <p><code>propertyListFromData:mutabilityOption:format:errorDescription</code></p> <p>Binary plists, can contain any objects and can be written and read using the NSKeyedArchiver and NSKeyedUnarchiver. To use these you must adopt the NSCoding protocol here is an example of these methods in an object that inherits from NSObject and has two properties: userId and userEmail.</p> <pre><code> + (void) initialize { [self setVersion:1]; // increment when you object format changes (add or remove properties) } - (id) initWithCoder:(NSCoder *)coder { if (self = [super init]) { NSInteger storedClassVersion = [coder versionForClassName:NSStringFromClass([self class])]; self.userId = [coder decodeObjectForKey:@"userid"]; self.userEmail = [coder decodeObjectForKey:@"useremail"]; if (storedClassVersion &gt; 1) { // Use this block to conditionally read properties in versions greater than 1 } } return self; } - (void) encodeWithCoder:(NSCoder *)coder { [coder encodeObject:self.userId forKey:@"userid"]; [coder encodeObject:self.userEmail forKey:@"useremail"]; } </code></pre> <p>When archiving I find it is useful to wrap up all of the objects to be persisted in an NSDictionary. This allows you to find individual objects by key when unarchiving. NSDictionary supports the NSCoding protocol making it really easy to do so.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload