Re: NSDictionary crash
Re: NSDictionary crash
On Sat, Jul 25, 2009 at 9:39 PM, Kyle Sluder<email@hidden> 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.
> The best answer at the moment is to file a Radar
I will. Thanks a lot for your help.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden