Bug 15710 - Static Linking Kills Gesture Recognizers in iOS
Summary: Static Linking Kills Gesture Recognizers in iOS
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 7.0.4.x
Hardware: Macintosh Mac OS
: --- critical
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-10-25 14:34 UTC by Kevin Mullins
Modified: 2013-10-25 15:15 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Kevin Mullins 2013-10-25 14:34:15 UTC
The change that you have to make to an Export command to support static linking causes Monotouch to blowup at a low level when using Gesture Recognizers.

Take the follow code snippet:

//Add double tap recognizer
_doubleTap = new UITapGestureRecognizer ();
_doubleTap.NumberOfTapsRequired = 2;
_doubleTap.AddTarget (this, new Selector ("OnDoubleTap"));
this.AddGestureRecognizer (_doubleTap);

/// <summary>
/// Handles the <see cref="Appracatappra.ActionComponents.ActionTray.UIActionTray"/> being double tapped
/// </summary>
/// <param name="sender">Sender.</param>
public void OnDoubleTap (UIGestureRecognizer sender) {

	//Take action based on the tray type
	switch (trayType) {
	case UIActionTrayType.Draggable:
		//Is this a valid touch?
		if (!_thumbHotspot.Contains(sender.LocationInView (this))) return;

		//Is the tray closed?
		if (isClosed) {
			//Yes, open tray
			OpenTray (true);
		} else {
			//No, close tray
			CloseTray (true);

		//Inform caller that we have been touched and moved


Changing [Export("OnDoubleTap")] to [Export("OnDoubleTap:")] compile with --registrar=static causes the iOS app to blow up on double tap with the error message "Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[UIActionTray OnDoubleTap]: unrecognized selector sent to instance 0x16572660"
Comment 1 Sebastien Pouliot 2013-10-25 15:15:28 UTC
Not sure I follow. 

>to support static linking

that always been supported and [Export] did not change. 

> --registrar=static

So you're trying the new static registrar ? it is less forgiving of errors.

> new Selector ("OnDoubleTap")
> [Export("OnDoubleTap:")]

Those two selectors are different. 

> -[UIActionTray OnDoubleTap]

The above code does not export "OnDoubleTap" but "OnDoubleTap:" so the native (ObjC) exception is correct (the later was not exported and never registered so it's unrecognized).

Not that the method signature (it has a parameter) tells you that "OnDoubleTap:" is the right name. It's likely you need to update your 

> new Selector ("OnDoubleTap")

to match the correct name.

Please attach a self-contained test case and re-open the bug report if that does not solve your issue.