• 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: Creating an NSDictionary out of NSData?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating an NSDictionary out of NSData?


  • Subject: Re: Creating an NSDictionary out of NSData?
  • From: Brian Webster <email@hidden>
  • Date: Thu, 17 Oct 2002 14:22:03 -0500

There is a new class available in Jaguar, the NSPropertyListSerialization class (declared in NSPropertyList.h), which has a class method, propertyListFromData:mutabilityOption:format:errorDescription: that will do what you want. If you need your program to run on systems before Jaguar, you should use the CFPropertyListCreateFromXMLData() function, declared in CFPropertyList.h. The former is simply a wrapper for the latter, but a little more convenient, as you don't have to make an explicit cast to NSDictionary*.

On Thursday, October 17, 2002, at 01:27 PM, email@hidden wrote:

This probably has a simple solution, but I have not been able to find
it in the docs. For strings I can do:

NSData *urlData = [url resourceDataUsingCache:[ii2Prefs useCache]];
NSString *contents = [[[NSString alloc] initWithData:urlData
encoding:NSUTF8StringEncoding] autorelease];

The reason I do it instead ofusing withContentsOfURL is that I want to
control the use of any cache. But how do I do the same with an
NSDictionary? How do I change:

NSDictionary *tmpDict = [NSDictionary dictionaryWithContentsOfURL:
dictURL];

into something where I can control the use of a cache?

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.

  • Prev by Date: Re: Table View and Tool Tips
  • Next by Date: Re: Parsing .vcf files SOLVED
  • Previous by thread: Re: Creating an NSDictionary out of NSData?
  • Next by thread: Re: Table View and Tool Tips
  • Index(es):
    • Date
    • Thread