You can give propertyListFromData: a C string!
You can give propertyListFromData: a C string!
- Subject: You can give propertyListFromData: a C string!
- From: Jerry Krinock <email@hidden>
- Date: Sat, 27 May 2006 11:24:59 -0700
- Thread-topic: You can give propertyListFromData: a C string!
I am trying to fix a bug in my program. The bug causes a C string to be fed
to NSPropertyListSeralization for deserialization. The crazy thing is, it
actually works:
char* hello = "Hello" ;
NSData* data = [[NSData alloc] initWithBytes:hello length:5] ;
NSString *plistError;
NSPropertyListFormat format;
id plist ;
plist = [NSPropertyListSerialization propertyListFromData:data
mutabilityOption:NSPropertyListImmutable
format:&format
errorDescription:&plistError];
NSLog(@"Detected plist format as: %i", format) ;
NSLog(@"Deserialized plist to get a %@: %@",
[plist class],
plist) ;
You'd think plist is going to be nil? Nope...
MyApp[2076] Detected plist format as: 1
MyApp[2076] Deserialized plist to get a NSCFString: Hello
One telltale clue is that format = 1 is defined as
kCFPropertyListOpenStepFormat, which I have never seen before.
So that I can clear my head and continue working on the REAL bug, could
someone please confirm: (a) Am I nuts, or (b) did OpenStep "serialize" an
NSString by simply pumping out its ASCII bytes?
Jerry
_______________________________________________
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