iOS - how to read and write a plist of this format
- by Suchi
I have an xml of the following format -
<plist version="1.0">
<array>
<dict>...</dict>
<dict>...</dict>
</array>
</plist>
I am trying to write it into a plist using -
NSDictionary *temp = [NSPropertyListSerialization propertyListWithData:returnData options:NSPropertyListImmutable format:&format error:&errorDesc];
[self writeToPlistFile:@"myList.plist" : temp];
where the method is
-(BOOL)writeToPlistFile:(NSString*)filename:(NSDictionary*)data{
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * documentsDirectory = [paths objectAtIndex:0];
NSString * path = [documentsDirectory stringByAppendingPathComponent:filename];
BOOL didWriteSuccessfull = [data writeToFile:path atomically:YES];
return didWriteSuccessfull;
}
I then want to read it and place it into a dictionary. How would I do that?