Re: NSDictionary crash
Re: NSDictionary crash
- Subject: Re: NSDictionary crash
- From: Kyle Sluder <email@hidden>
- Date: Sat, 25 Jul 2009 11:20:35 -0700
On Jul 25, 2009, at 11:00 AM, "email@hidden" <email@hidden
> wrote:
I find the third option the most likely: iTunes rewrites the data file
frequently. Is there a way to lock the file while reading it, or
detect if it is being modified, or suchlike? Thanks.
You aren't guaranteed that the iTunes library file will always be a
plist. The "correct" recommendation, which will also solve your issue,
is to use Apple Events to get the information you need.
In the general case, since you didn't write -[NSDictionary
initWithContentsOfFile:], you can't make it safe. You'll have to open
the file and read it's data yourself, then hand that off to the
NSDictionary initializer (or perhaps NSPropertyListSerialization).
--Kyle Sluder
_______________________________________________
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