我有以下格式的 xml -
<plist version="1.0">
<array>
<dict>...</dict>
<dict>...</dict>
</array>
</plist>
我正在尝试使用 - 将其写入 plist
NSDictionary *temp = [NSPropertyListSerialization propertyListWithData:returnData options:NSPropertyListImmutable format:&format error:&errorDesc];
[self writeToPlistFile:@"myList.plist" : temp];
方法在哪里
-(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;
}
然后我想阅读它并将其放入字典中。我该怎么做?