• 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: Encode a 'Class' type using NSValue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Encode a 'Class' type using NSValue


  • Subject: Re: Encode a 'Class' type using NSValue
  • From: Jens Alfke <email@hidden>
  • Date: Fri, 14 May 2010 10:15:29 -0700


On May 14, 2010, at 2:45 AM, Billy Flatman wrote:

Thanks for you help. I am trying to pass the class reference around for drag and drop, I think i'll try your idea of converting the pointer to a number,

Encoding pointer values in archives is a very bad idea, since if the archive gets decoded in a different process, the pointer will be garbage and very likely to cause a crash.


You may think this isn't a problem for D&D since the result will get used immediately, but it's fairly easily for drags to get persisted: just drag to the Finder and you'll get a clipping file that can be dragged back into your app at any future time. It's also possible that another app might want to make itself interoperable with your app's drag format, which would be impossible if you use pointers.

Why not just archive the class's name?

—Jens_______________________________________________

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: 
 >Encode a 'Class' type using NSValue (From: Billy Flatman <email@hidden>)
 >Re: Encode a 'Class' type using NSValue (From: Quincey Morris <email@hidden>)
 >Re: Encode a 'Class' type using NSValue (From: Billy Flatman <email@hidden>)

  • Prev by Date: Re: [[NSFileManager alloc] init] considered thread-safe
  • Next by Date: Re: TUTORIAL: Generating Unique ID Strings
  • Previous by thread: Re: Encode a 'Class' type using NSValue
  • Next by thread: Re: Encode a 'Class' type using NSValue
  • Index(es):
    • Date
    • Thread