bug in NSPropertyListSerialization +dataFromPropertyList:format:errorDescription:
bug in NSPropertyListSerialization +dataFromPropertyList:format:errorDescription:
- Subject: bug in NSPropertyListSerialization +dataFromPropertyList:format:errorDescription:
- From: Eric Ocean <email@hidden>
- Date: Thu, 14 Oct 2004 12:09:19 -0700
I have already submitted this bug to Apple. The bug ID# is: 3840003
Here's code that illustrates the bug:
/*
From Apple's Xcode 1.5 / Panther 10.3.5 documentation:
+ (NSData *)
dataFromPropertyList:(id)plist
format:(NSPropertyListFormat)format
errorDescription:(NSString **)errorString
Returns an NSData object in the property list format specified by plist or nil if plist does not represent a valid
property list. plist must be a kind of NSData, NSString, NSNumber, NSDate, NSArray, or NSDictionary. Container
objects must also contain only these kinds of objects. On return, if the conversion is successful, errorString
is nil. If the conversion fails, errorString points to a string describing the nature of the error. If you receive
a string, you must release it. Possible values for format are described in “Constants”.
*/
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSArray *plist = [NSArray arrayWithObject:@"foo"];
NSString *error;
NSData *data = [NSPropertyListSerialization dataFromPropertyList:plist
format:NSPropertyListXMLFormat_v1_0
errorDescription:&error];
if (data) NSLog(@"data is valid");
// error is not nil, even though the call to dataFromPropertyList:format:errorDescription: succeeded
if (error)
{
NSLog(@"LayerLink: %@", error); // causes crash because error points to garbage
[error release];
}
[pool release];
return 0;
}
Before anyone writes to tell me that I should be initializing my variables, I considered the NSPropertyListSerialization to *be* my initializer. According to the documentation, it sets it to an NSString * or nil.
Regards,
Eric Ocean
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden