xamarin / Essentials

Xamarin.Essentials is no longer supported. Migrate your apps to .NET MAUI, which includes Maui.Essentials.
https://aka.ms/xamarin-upgrade
Other
1.52k stars 506 forks source link

[Bug] Flashlight.TurnOnAsync / Off crash on iPad 5th gen (no flash on those) #1834

Open softlion opened 3 years ago

softlion commented 3 years ago

Description

On iPad without flash lights, using Flashlight.TurnOnAsync / TurnOffAsync is crashing.

https://en.wikipedia.org/wiki/IPad_(5th_generation)

Expected Behavior

Instead it should does nothing.
Or provide a method Flashlight.IsSupported()

Actual Behavior

Crash

image

Basic Information

jamesmontemagno commented 3 years ago

Yes, we throw an exception when it is not supported -> https://github.com/xamarin/Essentials/blob/main/Xamarin.Essentials/Flashlight/Flashlight.ios.cs#L26