xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] App Deployed To Apple App Store Has Non-Functional Buttons, Gesture Recognizers #15349

Open ctmobiledev opened 2 years ago

ctmobiledev commented 2 years ago

Greetings, folks. This is not going to be one of your typical bug report submissions because it's a bit more complicated.

As a preface, in order to see this bug in action, it requires being a member of Apple's Developer Program. This is because the resulting archived (deployed) *.ipa package file generated via Xamarin and Visual Studio had to be uploaded to Apple's AppStoreConnect infrastructure (this is their administrative portal by which app submissions make it into their App Store). It wasn't until end users (and myself) downloaded the app from their App Store and installed it that this particular issue became apparent.

Here's the bug: Button controls, and Gesture Recognizers, are non-responsive in the resulting archived executable package generated via Xamarin Forms, and deployed to Apple's AppStoreConnect portal. Put more bluntly, an iOS app built with Xamarin Forms, when someone downloads it from the App Store, will not have buttons that work. The app can be started, and the app buttons are visible, but in many cases, the buttons, when tapped, do nothing.

At first, I thought perhaps the issue was that I was "layering" a Grid underneath a button with a transparent color. I did this because Button controls only allow one line of text. But on other screens I ran, a simple button with a single word of text didn't "click" also. I also saw that attaching a GestureRecognizer object to a Label failed also.

You will not see this bug if you run an app containing a button in Debug mode for iOS under Xamarin Forms. I never observed any issues testing an app I wrote with a button. And you will not see this issue for Android or UWP, either. A finalized version of Android has no issues with Button objects. I am waiting to see if my app is approved by the Microsoft Store, after which point I can verify whether this issue affects UWP also.

It was especially embarrassing experiencing this because (1) I had used Xamarin Forms a year ago to release an app to the iOS and Android platforms without any issues with buttons, and (2) a user reported this after the app went live.

Description

Button controls (and also GestureRecognizer objects) are non-responsive AFTER an app has been archived, deployed, and downloaded from Apple's App Store.

Steps to Reproduce

NOTE: This issue requires knowledge of the iOS submission procedure, which includes generation of App ID's, provisioning profiles, and distribution profiles. If anyone there at Microsoft or in the Xamarin Forms project has such credentials that/those individuals would be suitable to work on this issue.

  1. Create any single-page app. Include one or more Button controls or a GestureRecognizer, attached to a Label control. Such controls could trigger a simple action like a DisplayAlert, or a call to a second ContentPage.
  2. Run and test the project in Debug mode to ensure proper operation.
  3. Change the version from Debug to Release mode and use the Archive Manager to generate an IPA file (IPA is Apple's file format for executables for the iPhone App Store.
  4. Submit the resulting IPA file to Apple's AppStoreConnect portal, on a Mac computer, using Apple's Transporter app.
  5. Upon notification by e-mail from Apple, go to the app listing in the App Store app, and download the app to an iPhone device.
  6. Start the app and begin tapping Buttons, or Labels with GestureRecognizer objects attached. No activity will occur.

Expected Behavior

Any actions defined to the Button control, or the Label with a GestureRecognizer attached, should be fired. If a Clicked event is coded to produce a certain action, that action should be observed.

Actual Behavior

Nothing happens. In the case of the app I wrote, another ContentPage was supposed to have appeared, but didn't.

Basic Information

Environment

Microsoft Visual Studio Community 2022 Version 17.1.4 VisualStudio.17.Release/17.1.4+32407.343 Microsoft .NET Framework Version 4.8.04161

Installed Version: Community

Visual C++ 2022 00482-90000-00000-AA877 Microsoft Visual C++ 2022

ASP.NET and Web Tools 2019 17.1.358.51495 ASP.NET and Web Tools 2019

Azure App Service Tools v3.0.0 17.1.358.51495 Azure App Service Tools v3.0.0

C# Tools 4.1.0-5.22165.10+e555772db77ca828b02b4bd547c318387f11d01f C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.6 (master@34d6af2) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 17.1.10 (65f98f5) Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 6.1.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

TypeScript Tools 17.0.1229.2001 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.1.0-5.22165.10+e555772db77ca828b02b4bd547c318387f11d01f Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.1.0-beta.21610.4+07b5673e4f2fa7630e78abe37f16b372353a7242 Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.

VisualStudio.DeviceLog 1.0 Information about my package

VisualStudio.Foo 1.0 Information about my package

VisualStudio.Mac 1.0 Mac Extension for Visual Studio

Xamarin 17.1.0.329 (d17-1@bc74cf0) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 17.1.0.87 (remotes/origin/main@d50fb5635) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 17.1.8 (590388a) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 12.2.4.3 (d17-1/fc1125e) Xamarin.Android Reference Assemblies and MSBuild support. Mono: adf1bc4 Java.Interop: xamarin/java.interop/d17-1@7ac33610 ProGuard: Guardsquare/proguard/v7.0.1@912d149 SQLite: xamarin/sqlite/3.37.1@0893b3b Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-1@db125a7

Xamarin.iOS and Xamarin.Mac SDK 15.8.0.5 (cc19b50de) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Build Logs

Not applicable for this issue

Screenshots

Not applicable for this issue

Reproduction Link

Not applicable for this issue

Workaround

None found at this time

jfversluis commented 2 years ago

I think the TapGestureRecognizers are one of the things that might be stripped out, you might want to read up on this page and play with these settings: https://docs.microsoft.com/xamarin/ios/deploy-test/linker?tabs=macos

ctmobiledev commented 2 years ago

Thanks for the comment, but this doesn't explain why some of the ordinary Button objects don't fire, either.

I am not a system developer so this discussion of linking options isn't immediately helpful. I didn't change any link settings for a previous iOS app I deployed to the App Store last year (which didn't have this same issue), so I'm wondering why I would need to alter Xamarin link settings this time.

New builds of Xamarin Forms have rolled out since last year, as well as the in-process migration from VS 2019 to VS 2022 everyone is dealing with. My belief is something changed on the Xamarin Forms side somehow - perhaps in how iOS compilation services and utilities are called - but it could be a flaw on the iOS/macOS side as well.