Xamarin.forms: [Bug] [iOS] App crashes on iPhone 6 running iOS 11 after updating to XF 4.x.

Created on 8 Aug 2019  路  5Comments  路  Source: xamarin/Xamarin.Forms

Description

Native stack trace of crash:
DEBUG|8/5/2019 8:19:53 PM|App: Failed to init Home View|EX:Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[Xamarin_Forms_Platform_iOS_PlatformRenderer setNeedsUpdateOfHomeIndicatorAutoHidden]: unrecognized selector sent to instance 0x104f8bea0

This issue is due to adding functionality in XF 4.0 to support hiding the home indicator on iPhone X/Xs/Xr devices, as per:
https://github.com/xamarin/Xamarin.Forms/pull/5717

It would seem that on some devices that run iOS 11 that do not have a home indicator, i.e. any iPhone with a home button, do not have the setNeedsUpdateOfHomeIndicatorAutoHidden selector, so when XF calls:

if (Forms.IsiOS11OrNewer)
      SetNeedsUpdateOfHomeIndicatorAutoHidden();

on a phone running iOS 11 that does not support the home indicator, then the crash occurs.

An easy and seemingly harmless fix would be to check that the calling object responds to that selector, so instead of the above version check do the following selector check:

if (this.RespondsToSelector(new ObjCRuntime.Selector("setNeedsUpdateOfHomeIndicatorAutoHidden")))
   SetNeedsUpdateOfHomeIndicatorAutoHidden();

I also found anther report of the same issue where the fix was to do the resondsToSelector check:
https://github.com/lionheart/openradar-mirror/issues/18762

These are all of the places in XF source code that call that method that I found with a search:
https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs#L94
https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/ModalWrapper.cs#L107
https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs#L193
https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs#L528
https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs#L342
https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs#L234

Steps to Reproduce

I cannot reproduce since I do not have an iPhone 6 running iOS 11 (or any other < iPhone X device running iOS 11). Issue does not reproduce on simulators.

Basic Information

  • Version with issue: XF >= 4.0
  • Last known good version: XF 3.6 (does not call the SetNeedsUpdateOfHomeIndicatorAutoHidden method)
  • IDE:
  • Platform Target Frameworks:

    • iOS: 12.14.0.114

  • Affected Devices: iPhone 6 running iOS 11 (only reported device)
high regression in-progress iOS 馃崕 bug

All 5 comments

We've just uplifted our Xamarin libraries to 4.x. We are able to recreate this on a physical device running 11.0. This negatively impacts our release as we have customers running the affected OS version. An urgent fix is needed and much appreciated!

@StinkyTowel a PR is in the works, please follow the progress in #7114. This is going to be in 4.0, 4.1 and 4.2 which all have frequent releases so it should hopefully be resolved soon.

Thanks!

@jfversluis Will follow the PR. Thanks for the quick response!

closed by #7151

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hartez picture hartez  路  55Comments

hartez picture hartez  路  59Comments

dannythomas13 picture dannythomas13  路  56Comments

jassmith picture jassmith  路  199Comments

EdoardoCinelli picture EdoardoCinelli  路  92Comments