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

Re: NSMutableDictionary -> NSData


  • Subject: Re: NSMutableDictionary -> NSData
  • From: Brian Webster <email@hidden>
  • Date: Mon, 24 Jun 2002 21:27:34 -0500

On Monday, June 24, 2002, at 08:25 PM, cocoa-dev-
email@hidden wrote:

So... How can I use NSFileWrapper to store the file easily in "plist"
format
if the information is in a dictionary??

If you want an XML property list in an NSData object, you can use the Core Foundation function CFPropertyListCreateXMLData().

NSDictionary *myDictionary;
NSData* plistData;

plistData = (NSData*)CFPropertyListCreateXMLData(NULL, (CFPropertyListRef)myDictionary);

For writing this data to a file, NSFileWrapper isn't really necessary. Like you said, you can send a writeToFile:atomically: message to the dictionary, or you could also send the same message to the NSData object with the same results. If you wanted to write it via NSFileWrapper, you could create one using initRegularFileWithContents: and then write it to a file, but it wouldn't really gain you anything. Is there a particular reason you want to use NSFileWrapper, or was it just the first thing to pop out at you?

--
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.

  • Follow-Ups:
    • Re: NSMutableDictionary -> NSData
      • From: email@hidden
  • Prev by Date: large numerical arrays
  • Next by Date: Re: Mutable class problems
  • Previous by thread: Re: large numerical arrays
  • Next by thread: Re: NSMutableDictionary -> NSData
  • Index(es):
    • Date
    • Thread