• 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: Problems with Distributed Objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with Distributed Objects


  • Subject: Re: Problems with Distributed Objects
  • From: Philippe Mougin <email@hidden>
  • Date: Thu, 26 Feb 2004 18:02:03 +0100

Am 26.02.2004 um 15:44 schrieb Philippe Mougin:

>> Have you implemented the replacementObjectForPortCoder: method as
>> described at
>>
http://developer.apple.com/documentation/Cocoa/Conceptual/DistrObjects/
>> index.html ?
>
> No.
>
> I don't want to "allow an object to encode itself as an instance of
> another class or to replace another object for itself". So how would
> that help?

It would allow you to prevent your object to substitute an
NSDistantObject to itself as it does now (since this the default
implementation provided at the NSObject level).

According to the doc:

"The generic replacementObjectForCoder: method offers a standard way to
substitute a different instance at encoding time.
replacementObjectForPortCoder: specifically allows for the substitution
of proxies over a distributed objects connection. The receiver of a
replacementObjectForPortCoder: message can ask the NSPortCoder whether
it should be encoded bycopy or not, and return itself or a proxy as
appropriate. NSObjects implementation always returns a proxy, so
subclasses that allow bycopy encoding should override
replacementObjectForPortCoder: to perform at least as this sample does:

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

If the NSPortCoder returns YES when sent an isBycopy message, this
example method returns self, which results in the receiver being sent
an encodeWithCoder: message. If the NSPortCoder returns NO, this method
invokes the superclasss implementation, which typically returns an
NSDistantObject."

Best,

Philippe Mougin
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Problems with Distributed Objects
      • From: Andreas Mayer <email@hidden>
  • Prev by Date: The best method to print an NSString with HTML content
  • Next by Date: Re: canCloseDocumentWithDelegate
  • Previous by thread: Re: Problems with Distributed Objects
  • Next by thread: Re: Problems with Distributed Objects
  • Index(es):
    • Date
    • Thread