richard@brainstorm.co.uk
)mccallum@gnu.ai.mit.edu
)Version: 27581
Date: 2009-01-12 18:36:37 +0000 (Mon, 12 Jan 2009)
Copyright: (C) 1997 Free Software Foundation, Inc.
- Declared in:
- Foundation/NSDistantObject.h
- Conforms to:
- NSCoding
Returns the method signature describing the arguments and return types of the method in the object referred to by the receiver which implements the aSelector message.
This method may need to refer to another process (causing relatively slow network communication) and approximately double the time taken for sending a distributed objects message, so you are advised to use the -setProtocolForProxy: method to avoid this occurring.
A key method for Distributed Objects performance. This sets the a protocol that the distant object referred to by the proxy should conform to. When messages in that protocol are sent to the proxy, the proxy knows that it does not need to ask the remote object for the method signature in order to send the message to it, but can send the message straight away based on the local method signature information obtained from the protocol.
if ([anObj isProxy] == YES) { [anObj setProtocolForProxy: @protocol(MyProtocol)]; }
It is highly recommended that you make use of this facility, but you must beware that versions of the compiler prior to 3.3 suffer a serious bug with respect to the @protocol directive. If the protocol referred to is not declared and implemented in the file where @protocol is used to refer to the protocol by name, a runtime error will occur when you try to use it.
Beware, if you don't use this method to set the
protocol, the system might well ask the remote
process for method signature information, and the
remote process might get it wrong. This
is because the class of the remote object needs to
have been declared to conform to the protocol in
order for it to know about any protocol qualifiers
(the keywords
bycopy, byref, in, out, inout,
and
oneway
). If the author of the server
process forgot to do this, the type information
returned from that process may not be what you
are expecting.
The class of the server object should be declared like this...
@interface MyServerClass : NSObject <MyProtocol> ... @end