• 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
Re: NSData to plist
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSData to plist


  • Subject: Re: NSData to plist
  • From: Chris Kane <email@hidden>
  • Date: Fri, 6 Dec 2002 08:48:48 -0800

On Friday, December 6, 2002, at 12:16 AM, Drew McCormack wrote:

On Friday, December 6, 2002, at 04:57 AM, crucial felix wrote:
I swiftly got it as an NSData, but now i'm trying to figure out how to get it out of that.

i try using this: NSPropertyListSerialization method:
+ (id)propertyListFromData:(NSData *)data mutabilityOption:(NSPropertyListMutabilityOptions)opt format:(NSPropertyListFormat *)format errorDescription:(NSString **)errorString


NSData *data = [NSData dataWithContentsOfFile:[@"~/Music/iTunes/iTunes Music Library.xml" stringByStandardizingPath]];

NSDictionary *plist = [NSPropertyListSerialization
propertyListFromData:data mutabilityOption:NSPropertyListMutableContainersAndLeaves
format:NSPropertyListXMLFormat_v1_0
errorDescription:@"blah"];


The third parameter is a NSPropertyListFormat *, not NSPropertyListFormat, as shown in the method declaration. Also the fourth parameter is a NSString **, not an NSString *.

NSPropertyListFormat theFormat;
NSString *theError;

NSDictionary *plist = [NSPropertyListSerialization
propertyListFromData:data
mutabilityOption:NSPropertyListMutableContainersAndLeaves
format:&theFormat
errorDescription:&theError];

The format is returned to you, in case you want to preserve it because you're going to modify and rewrite the file. The error string is also returned by reference. Either of these parameters can be NULL instead of a pointer to storage, if you don't want the value.


Chris Kane
Cocoa Frameworks, Apple
_______________________________________________
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.

References: 
 >Re: NSData to plist (From: Drew McCormack <email@hidden>)

  • Prev by Date: Re: [req] cocoa-gui for mantis
  • Next by Date: Re: [req] cocoa-gui for mantis
  • Previous by thread: Re: NSData to plist
  • Next by thread: Re: NSData to plist
  • Index(es):
    • Date
    • Thread