Xamarin-macios: [Bug] [iOS] Tap GestureRecognizers not working in iOS 13.4

Created on 2 May 2020  路  8Comments  路  Source: xamarin/xamarin-macios

xamarin/Xamarin.Forms#7922 # Description

The game we are developing, was yesterday for the first time simulated on IOS and also deployed to an iPhone. In both simulations and the actual device, there are areas in the game with the TapGesture Recogniser / Tap Event is broken on IOS. Everything happy in Android as its always been.

All the code is the shared project.

The bug happens in areas where a TapGesture has been added to a BoxView, however this is how we handle all tap events in the game, and there are many areas in the game where this works just fine, which will make tracking down this bug harder....

I am sure that this bug is related to : [Bug] [iOS] GestureRecognizers not working in iOS 13.4 xamarin/Xamarin.Forms#10162

Which apparently has been fixed, however possibly there is somewhere else in your source code that needs to be fixed in a similar manner that was missed? - if possible can you guys take a look again? see if there is any spot you missed?

Our project is huge, and its going to take me a while and a lot of effort to try to create a one page project with steps to reproduce, (something I am working on as we speak), so please be patient on that, I will get you steps to reproduce as soon as I possibly can. I have posted the bug, here so we can get the ball rolling on this one, its a critical critical issue, not being able to handle tap events!

Steps to Reproduce

Working furiously to get you a mini project to look at.

  • IDE: VS Mac 8.5.4 (build 12)
  • iOS 13.4
    (Everything mono, etc.. was setup on the mac yesterday, and paired with the PC (which was also upgraded to the latest everything, pair and simulation on pc worked fine)
    The build and deploy to the iPhone was done on the Mac directly.
need-info

Most helpful comment

@thisismyself @whitneyschmidt @samhouts @dalexsoto thank you all for subsequent posts to my work around, glad its been fixed!!!

All 8 comments

I have attached a sample mini project that displays this Bug behaviour
TapGesture_BoxView_Bug.zip

This so called bug may have existed in previous versions of Xamarin and iOS however as I only deployed to iOS 2 days ago for the first time I cannot be sure.

However I am glad to report the 'bug' is not Xamarin side, it is in the way my code is written and in how iOS interprets it differently to Android.

Here is the solution:

When adding a box view into a Grid Cell , I was using the BoxView Opacity Property to make the BoxView transparent.
I was using:
BoxView bv = new BoxView();
bv.Opacity = 0; //make the BoxView transparent.

Seems iOS does not like this very much....

It prefers:

bv.Color = Color.Transparent;
bv.Opacity = 0.1; //Any value but 0 will do

Then you can add the tapgesture as per normal :

            TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer();
            tapGestureRecognizer.Tapped += clickedOnBoxView;
            bv.GestureRecognizers.Add(tapGestureRecognizer);

In the end a very simple solution. Bug can be closed, but should probably be left for people to search / discover it?

thanks
Rob

We are compiling with two Macs and we have this issue when we compile on the Mac which has XCode 11.4.1. On the Mac with XCode 11.4 it works, I guess cause we are compiling against a pre-iOS-13.4 SDK.

Visual Studio 2019 (for Windows): 16.5.4
MacOS: 10.15.4
XCode: 11.4.1 --> TapGestureRecognizer Issue
XCode: 11.4 --> Everything good
Xamarin.Forms: 4.6.0.726

@thisismyself Can you please attach a small project that demonstrates this issue? Thanks!

@thisismyself also make sure that you have the latest stable Xamarin.iOS as of today (>= Xamarin.iOS 13.16.0.13) and that you do not have Xamarin.iOS 13.16.0.11 in any of your two machines.

@samhouts @dalexsoto I cannot reproduce the issue anymore. We guess the installation of Xamarin.iOS 13.16.0.13 package update failed on the failing Mac and we didn't notice this. Thank you for help.

Closing as this issue as it is no longer repro.

@thisismyself @RobDaytona thank you for sharing this issue with us, if you begin encountering it again feel free to reopen this issue.

@thisismyself @whitneyschmidt @samhouts @dalexsoto thank you all for subsequent posts to my work around, glad its been fixed!!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

whitneyschmidt picture whitneyschmidt  路  3Comments

iulian-mirica picture iulian-mirica  路  3Comments

wcoder picture wcoder  路  3Comments

chamons picture chamons  路  4Comments

orryverducci picture orryverducci  路  4Comments