Le 25 juil. 09 à 21:59, slasktrattena...@gmail.com a écrit :

On Sat, Jul 25, 2009 at 9:39 PM, Kyle Sluder<kyle.slu...@gmail.com> wrote:
As I mentioned, look at NSPropertyListSerialization. NSDictionary is a plist
type and can be decoded from an NSData.

OK, thanks.

Also, is the NSData equivalent any safer than NSDictionary's? It's
initWithContentsOfFile: method is documented to return "An initialized
object—which might be different than the original receiver—that
contains the dictionary at path, or nil if there is a file error or if
the contents of the file are an invalid representation of a
dictionary." There's no mention of a potential crash. Should I file a
bug?

You can ensure the safety of the file before using NSData. You can't when
using NSDictionary's convenience constructor.

Sorry for being ignorant, but how do I ensure the safety of the file?
I don't see anything about this in the NSData API.

One issue that you will encounter, however, is that iTunes is incredibly picky about its file store. It will throw a tantrum if it can't write to its
database.

Hmm, OK. I suppose I could go for Apple Events when iTunes is running
and only read the xml data when it's not. Shame about the speed,
though.


Ironically, I'm using the same approach but for the inverse reason. It's faster with Apple events than reading the whole XML File.



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to