Plist is short for property list. It is just a filetype used by Apple to store data.
it has three format
format enum:
1 2 3 4 5
| enum { NSPropertyListOpenStepFormat = kCFPropertyListOpenStepFormat, NSPropertyListXMLFormat_v1_0 = kCFPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0 = kCFPropertyListBinaryFormat_v1_0 }; NSPropertyListFormat;
|
how to convert format
Converting a plist File to XML from Binary
1
| plutil -convert xml1 ExampleBinary.plist
|
1
| plutil -convert binary1 Example.plist
|
what is OpenStepFormat?
it is like this
1 2 3 4 5 6 7 8
| { Filter ={ Bundles = ( test, verb ); }; }
|
no tool found
but you can use this code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| NSError *error; NSData *data = [NSData dataWithContentsOfFile: path options: 0 error: &error;]; if (data == nil) { NSLog (@"error reading %@: %@", path, error); return nil; }
NSPropertyListFormat format; id plist = [NSPropertyListSerialization propertyListWithData: data options: NSPropertyListImmutable format: &format error: &error]; if (plist == nil) { NSLog (@"could not deserialize %@: %@", path, error);
} if (![NSPropertyListSerialization propertyList: plist isValidForFormat: kCFPropertyListXMLFormat_v1_0]) { NSLog (@"can& return; } BOOL writeStatus = [data writeToFile: @"plist.txt" options: NSDataWritingAtomic error: &error;]; if (!writeStatus) { NSLog (@"error writing to file: %@", error); return; }
|