RE: Deserializing binary file
RE: Deserializing binary file
- Subject: RE: Deserializing binary file
- From: "Jonathan E. Jackel" <email@hidden>
- Date: Thu, 11 Sep 2003 10:25:35 -0400
>
NSString *error = nil;
>
>
[NSPropertyListSerialization
>
propertyListFromData:tbl
>
mutabilityOption:NSPropertyListMutableContainersAndLeaves
>
format:&NSPropertyListBinaryFormat_v1_0 // <--problematic line
>
errorDescription:&error];
>
}
NSPropertyListBinaryFormat_v1_0 should be a declared as a variable of type
NSPropertyListFormat. But it looks like you think you are setting the
format this way. That's not how it works. You are getting the format out
of the serialized data.
>
They never set the format-variabled as far as I can see, but I guess it
>
is supposed to be set somewhere outside this example.
Read the doc you quoted carefully. It says how the format is set. I have
set that part off in ^^^ below.
>
>
The API-documentation for propertyListFromData in
>
NSPropertyListSerialization:
>
>
propertyListFromData:mutabilityOption:format:errorDescription:
>
>
+ (id) propertyListFromData: (NSData *) data mutabilityOption:
>
(NSPropertyListMutabilityOptions) opt format: (NSPropertyListFormat *)
>
format errorDescription: (NSString **) errorString
>
Returns a property list object corresponding to the representation in
>
data of format format , or nil if data does not represent a property
>
list in a supported format. The mutability option opt determines
>
whether the property list's containers and/or leaves are mutable. If
>
the property list is valid, ^^^the format is returned through the pointer
>
format .^^^ Possible values for opt and format are described in
>
"Constants" .
>
>
See Also: + dataFromPropertyList:format:errorDescription:
In other words, you supply an address of a pointer (e.g., &format) when you
send the message, and the method sets the value at that pointer to the
format.
Jonathan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.