• 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: Jean-Daniel Dupas <email@hidden>
  • Date: Sun, 26 Jul 2009 00:19:09 +0200


Le 25 juil. 09 à 21:59, email@hidden a écrit :

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.


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 (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: 
 >Re: NSDictionary crash (From: Kyle Sluder <email@hidden>)
 >Re: NSDictionary crash (From: "email@hidden" <email@hidden>)

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