• 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: Vince DeMarco <email@hidden>
  • Date: Thu, 5 Dec 2002 23:16:53 -0800

try this

plist = [[NSDictionary alloc] initWithContentsOfFile:[@"~/Music/iTunes/iTunes Music Library.xml" stringByExpandingTildeInPath]];

vince



On Thursday, December 5, 2002, at 07:57 PM, crucial felix wrote:

Hey y'all,

I'm trying to open my iTunes xml library. easily viewable in PropertyList editor, the root object is a Dictionary.

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"];

and get a:
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000064

Thread 0 Crashed:
#0 0x9013f354 in _CFPropertyListCreateFromXMLData
#1 0x90180484 in CFPropertyListCreateFromStream
#2 0x90844650 in +[NSPropertyListSerialization propertyListFromData:mutabilityOption:format:errorDescription:]

the errorDescription is obviously wrong and is possibly the trouble.

the java version specifies a String[]
i will say that the docs need an extra sentence there.


trying:

NSDictionary *plist = [NSKeyedUnarchiver unarchiveObjectWithFile:[@"~/Music/iTunes/iTunes Music Library.xml" stringByStandardizingPath]];

gives:
[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive version (-1)


help greatly appreciated.

-felix
_______________________________________________
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.
_______________________________________________
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: 
 >NSData to plist (From: crucial felix <email@hidden>)

  • Prev by Date: NSButton highlight - ignore
  • Next by Date: Re: runtime error using NSArray with NSButton
  • Previous by thread: NSData to plist
  • Next by thread: Re: NSData to plist
  • Index(es):
    • Date
    • Thread