MonoTouch docs indicate that the method maps to the Obj-C performSelector:withObject:afterDelay , which only supports calling a selector with one argument.
The best way to handle this is what you need to do. One of the typical ways to deal with this would be to put the arguments as properties / fields in one NSObject, then the target will be changed to have one argument, and get the real arguments from this method. If you did this using the special MonoTouch object, you would need to ensure that the GC builds a managed peer if nothing in the managed code contains a link to it.
The best solution will depend on how you use it. For example, in your example, you can trivially call the C # method directly, for example.
_HandleSaveButtonTouchUpInside (url, data);
If you need to send via Obj-C for some reason, but do not need to delay, use MonoTouch.ObjCRuntime.Messaging , for example
MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr ( target.Handle, MonoTouch.ObjCRuntime.Selector.GetHandle ("_HandleSaveButtonTouchUpInside"), arg0.Handle, arg1.Handle);
If you need a delay, you can use NSTimer . MonoTouch added special support for using the NSAction delegate, so you can use C # lambda to safely store arguments.
NSTimer.CreateScheduledTimer (someTimespan, () => _HandleSaveButtonTouchUpInside (url, data));
Mikayla hutchinson
source share