• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDictionary crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDictionary crash


  • Subject: Re: NSDictionary crash
  • From: "email@hidden" <email@hidden>
  • Date: Sat, 25 Jul 2009 21:36:00 +0200

On Sat, Jul 25, 2009 at 9:28 PM, Alexander
Heinz<email@hidden> wrote:
>
> On Jul 25, 2009, at 11:20 AM, Kyle Sluder wrote:
>
>> 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
>
> An alternative would be to copy the file to a temporary location, and then
> read from it, as long as you are okay with the version in memory being
> slightly out-of-date.

Yes, that's okay. But how would I know the file is readable at the
time I copy it?

> However, as Kyle points out, this is not necessarily a
> safe way to do things going forward, and Apple Events is probably what you
> want.
>
> - Alex Heinz
>
_______________________________________________

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

References: 
 >NSDictionary crash (From: "email@hidden" <email@hidden>)
 >Re: NSDictionary crash (From: Bill Bumgarner <email@hidden>)
 >Re: NSDictionary crash (From: "email@hidden" <email@hidden>)
 >Re: NSDictionary crash (From: Kyle Sluder <email@hidden>)
 >Re: NSDictionary crash (From: Alexander Heinz <email@hidden>)

  • Prev by Date: Re: NSDictionary crash
  • Next by Date: Re: [iPhone] Why can't a UITextField be its own delegate?
  • Previous by thread: Re: NSDictionary crash
  • Next by thread: Re: NSDictionary crash
  • Index(es):
    • Date
    • Thread