FROM : Eric Ocean
DATE : Thu Oct 14 21:09:19 2004
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
DATE : Thu Oct 14 21:09:19 2004
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
| Related mails | Author | Date |
|---|---|---|
| Eric Ocean | Oct 14, 21:09 | |
| j o a r | Oct 15, 12:35 | |
| Charles Srstka | Oct 15, 20:38 |






Cocoa mail archive

