|
From: | Andreas Höschler |
Subject: | Re: Porting to 64Bit -descriptionForInstanceMethod: |
Date: | Tue, 18 Jun 2019 15:58:32 +0200 |
Hi David and all, a google search for Objective-C runtime functions of course led to and I thought I just had to select the proper method from the list and am done. But this does not seem to be that simple!? I found NSMethodSignature *methodSig = [[self class] instanceMethodSignatureForSelector:mySelector]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSig]; for getting the method signature of an instance method for a known class. But in my case I just have a protocol. What would be the replacement for methodDescription = [_protocol descriptionForInstanceMethod:aSelector]; char *types = methodDescription->types; NSMethodSignature *methodSig = [NSMethodSignature signatureWithObjCTypes:types]; with current objective-C runtime functions? Is that still possible at all? My search attempts for the proper runtime function so far led to void method_getReturnType(Method m, char *dst, size_t dst_len); void method_getArgumentType(Method m, unsigned int index, char *dst, size_t dst_len); unsigned int method_getNumberOfArguments(Method m); So I might be able to construct char *types = NULL; from this and then do NSMethodSignature *methodSig = [NSMethodSignature signatureWithObjCTypes:types]; but how do I get a Method from a given selector and protocol?? I am lost! :-( Thanks a lot, Andreas
|
[Prev in Thread] | Current Thread | [Next in Thread] |