Using NSProxy and forwardInvocation:

I would like to encode a proxy server that forwards method calls to another object via TCP without NSConnectionand NSDistanceObject. What I want is my own protocol.

The problem is that the NSProxy subclass and redefinition are forwardInvocation:not enough. I also have to overridemethodSignatureForSelector

Here is my question:

– (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
    return ??? 
}
+5
source share
3 answers

I found an intelligent solution for creating objects NSInvocation.

0
source

@Brian. , setProtocolForProxy: . , . . .

, , " " methodSignatureForSelector: . , NSDistantObject.

setProtocolForProxy: - , , , , 10.5, ( ), 10.5 , .

@cocoafan, , , , , NSProxy, NSConnection , . ( ), , , NSDistantObject.

+2

NSDistantObject setProtocolForProxy:, , , . NSMethodSignature .

, protocol_getMethodDescription(), <objc/runtime.h>. objc_method_description, types. , +[NSMethodSignature signatureWithObjCTypes:], , .

+1

All Articles