Deep Copying (Built-In)

I’d previously presented some code that made deep copies of plists. I recently discovered that this code is superfluous, due to the CFPropertyListCreateDeepCopy method. You can invoke this function with a call such as this:

testData = CFPropertyListCreateDeepCopy(kCFAllocatorDefault, [NSDictionary dictionaryWithContentsOfFile:path], kCFPropertyListMutableContainersAndLeaves);

(This assumes that path has previously been set to something meaningful, and that testData will later be used for some good purpose.)

Better late than never, I suppose.

Share and Enjoy:
  • Twitter
  • Facebook
  • Digg
  • Reddit
  • HackerNews
  • del.icio.us
  • Google Bookmarks
  • Slashdot
This entry was posted in iPhone. Bookmark the permalink.

Comments are closed.