iPhone: Fastest way to create a binary Plist with simple key/value strings

Posted by randombits on Stack Overflow See other posts from Stack Overflow or by randombits
Published on 2010-05-05T18:06:11Z Indexed on 2010/05/05 18:18 UTC
Read the original article Hit count: 530

Filed under:
|
|
|

What's the best way to create a binary plist on the iPhone with simple string based key/value pairs? I need to create a plist with a list of recipe and ingredients. I then want to be able to read this into an NSDictionary so I can do something like

NSString *ingredients = [recipes objectForKey:@"apple pie"];

I'm reading in an XML data file through an HTTP request and want to parse all of the key value pairs into the plist. The XML might look something like:

<recipes>
   <recipe> 
     <name>apple pie</name>
     <ingredients>apples and pie</ingredients>
   </recipe>
   <recipe>
     <name>cereal</name>
     <ingredients>milk and some other ingredients</ingredients>
   </recipe>
</recipes>

Ideally, I'll be able to write this to a plist at runtime, and then be able to read it and turn it into an NSDictionary later at runtime as well.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa