The result of calling method_getImplementation(method)
is an IntPtr
. How do I convert an IntPtr
to a method?
[DllImport("/usr/lib/libobjc.dylib")]
extern static IntPtr method_getImplementation(IntPtr method);
public void SomeMethod
{
var method = class_getInstanceMethod(new UIViewController().ClassHandle, new Selector("viewWillAppear:").Handle);
IntPtr original_impl = method_getImplementation(method);
}
In obj-c:
IMP originalImp = method_setImplementation(method,swizzleImp);
originalImp(self,_cmd)