NSPropertyListSerialization error with apparently OK data
NSPropertyListSerialization error with apparently OK data
- Subject: NSPropertyListSerialization error with apparently OK data
- From: Graham Cox <email@hidden>
- Date: Thu, 18 Feb 2010 22:25:10 +1100
I have a structure I'm trying to write as an xml plist. The structure is an array of dictionaries, each dictionary contains a string "catname" and another array of dictionaries, "items". The second level of dictionaries consist of two strings each, "id" and "name".
Example:
(gdb) po catList
<NSCFArray 0x2e846a30>(
{
catname = "Legends & Inset Maps";
items = {(
{
id = "7CBC1609-ADFB-4CA9-A748-CABE9076842F";
name = "World - eastern hemisphere";
},
{
id = "402DEB4D-8C2E-4F4D-9151-E6BA01D194E7";
name = "World - western hemisphere";
},
{
id = "6500292B-FDE1-45B7-AFD9-8A0136B25717";
name = "Legend 4";
},
{
id = "CC96E4F2-1B20-4496-8962-15B617B3FAF9";
name = "Legend 2";
},
... hundreds of similar entries omitted...
)};
},
{
catname = "DrawKit Defaults";
items = {(
{
id = "6B1A0430-204A-4012-B96D-A4EE9890A2A3";
name = "Basic Track";
},
{
id = "1DFD6D8A-6C8B-4E4B-9186-90F64654F79F";
name = Basic;
},
{
id = "326CF635-7863-42C6-900D-CFFC7D57505E";
name = "Helvetica 18.0pt";
}
)};
}
)
When I submit this array to the serialization method:
NSData* data = [NSPropertyListSerialization dataFromPropertyList:catList format:NSPropertyListXMLFormat_v1_0 errorDescription:&errDesc];
(I know this is deprecated from 10.6 forward but I need to support 10.5 for now)
I get the error:
"Property list invalid for format"
Since I'm only using arrays, dictionaries and strings, that should be a valid plist, shouldn't it? I've missed something, but what?
I'm also wondering why some strings appear quoted and others are not when I dump the structure in gdb, and whether that's significant.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden