• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
You can give propertyListFromData: a C string!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: You can give propertyListFromData: a C string!
      • From: Ed Baskerville <email@hidden>
    • Re: You can give propertyListFromData: a C string!
      • From: Bill Bumgarner <email@hidden>
  • Prev by Date: Re: how do I check the defaults for an object?
  • Next by Date: Problems with Java Applet in WebView
  • Previous by thread: Re: how do I check the defaults for an object?
  • Next by thread: Re: You can give propertyListFromData: a C string!
  • Index(es):
    • Date
    • Thread