• 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: DO, bycopy
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DO, bycopy


  • Subject: Re: DO, bycopy
  • From: John Hörnkvist <email@hidden>
  • Date: Fri, 26 Oct 2001 00:03:38 +0200

On Thursday, October 25, 2001, at 11:51 PM, Miguel Morales wrote:

Dear all,

I have DO between 2 threads, and I'm having trouble getting the bycopy keyword to work for my classes and not just the foundation classes. Has anyone else seen this behavior, is there some magic handshake I need to get this to work? The behavior is described below:

I have a program with DO where I am passing objects using the bycopy keyword. This _should_ give me a new copy of the object in the new thread, where I can manipulate the copy locally.

You have to implement this yourself in your custom subclasses; NSObject doesn't handle it for you.

Look at NSPortCoder and classForPortCoder/replacementObjectForPortCoder.

- (id)replacementObjectForPortCoder:(NSPortCoder *)encoder
{
if ([encoder isBycopy]) return self;
return [super replacementObjectForPortCoder:encoder];
}

Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com


References: 
 >DO, bycopy (From: Miguel Morales <email@hidden>)

  • Prev by Date: Re: Hiding a view
  • Next by Date: Settings text in an NSScrollView
  • Previous by thread: DO, bycopy
  • Next by thread: Settings text in an NSScrollView
  • Index(es):
    • Date
    • Thread