How to return nil value to Objective-C using DLLImport and MonoPInvokeCallback. I'm trying to implement this solution iOS 7 UIWebView keyboard issue in Xamarin.iOs I'm able to get callback using this approach How to port "method_getImplementation" and "method_setImplementation" to MonoTouch?
I'm trying something like this. Delegate is called but IntPtr.Zero value isn't returned to Objective-c.
delegate IntPtr CaptureDelegate(IntPtr block, IntPtr self, IntPtr uiView);
[MonoPInvokeCallback(typeof (CaptureDelegate))]
static IntPtr MyCapture(IntPtr block, IntPtr self, IntPtr uiView)
{
return IntPtr.Zero;
}
public void SetImplementation(UIView subview)
{
var method = class_getInstanceMethod(subview.ClassHandle, new Selector("inputAccessoryView").Handle);
var block_value = new BlockLiteral();
block_value.SetupBlock(MyCapture, null);
class_addMethod(subview.ClassHandle, new Selector("inputAccessoryView").Handle, imp_implementationWithBlock(ref block_value), IntPtr.Zero);
}
How to return nil to obj-c?