Regression: Torch not working on iOS
See original GitHub issueEnabling the torch does not work here, using an iPhone 6 with iOS 12.4.8. The same code (example below) works fine on Android.
In general the flash light is definitely working on the device. I have also tried Xamarin.Essentials.FlashLight with success.
Can anyone reproduce this issue?
Code example
ScannerPage.xaml
<ContentPage.Content>
<Grid>
<zxing:ZXingScannerView x:Name="scannerView"
IsAnalyzing="{Binding IsAnalyzing}" />
<zxing:ZXingDefaultOverlay x:Name="scannerOverlay"
TopText="{x:Static resx:AppResources.ScannerTopText}"
BottomText="{x:Static resx:AppResources.ScannerBottomText}"
ShowFlashButton="True" />
</Grid>
</ContentPage.Content>
ScanPage.xaml.cs
using System;
using Xamarin.Forms;
using ZXing;
using ZXing.Mobile;
public partial class ScanPage
{
public ScanPage()
{
this.InitializeComponent();
this.InitializeScannerView();
}
protected override void OnAppearing()
{
base.OnAppearing();
this.scannerView.IsScanning = true;
}
protected override void OnDisappearing()
{
this.scannerView.IsScanning = false;
base.OnDisappearing();
}
private void InitializeScannerView()
{
this.scannerView.Options = new MobileBarcodeScanningOptions
{
PossibleFormats = new[] { BarcodeFormat.QR_CODE }
};
this.scannerView.OnScanResult += this.ScannerViewOnOnScanResult;
this.scannerOverlay.FlashButtonClicked += this.ScannerOverlayOnFlashButtonClicked;
}
private async void ScannerViewOnOnScanResult(Result result)
{
if (this.ViewModel.ScanResultCommand.CanExecute(result))
{
await this.ViewModel.ScanResultCommand.ExecuteAsync(result);
}
}
private void ScannerOverlayOnFlashButtonClicked(Button sender, EventArgs eventArgs)
{
this.scannerView.ToggleTorch();
}
}
Version info
Xamarin.Forms 4.8.0.1269 ZXing.Net.Mobile 3.0.0-beta5 ZXing.Net.Mobile.Forms 3.0.0-beta5
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Shipping a Neural Network on iOS with CoreML, PyTorch ...
I am not an expert when it comes to mechanical watches, but the main question hovering over this topic is: Will a watch...
Read more >TorchScript Error Unknown builtin op - Mobile
Hi there,. I am trying to use a torch script exported module traced on iOS device but I am getting this error:
Read more >Why regression model built using torch wont work well?
I am quite new with torch. And I have mostly difficulty with fitting simple feed forward network with some random data class Net(torch.nn....
Read more >15 Ways to Fix iPhone Flashlight Not Working in iOS 16
15 Ways to Fix iPhone Flashlight Not Working in iOS 16 · 1. Remove Any Cover · 2. Charge Your iPhone · 3....
Read more >Core ML | Apple Developer Forums
Hi everyone, I'm developing an iOS app which uses a PyTorch GPT2 model converted to Core ML via the Python coremltools. When I...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’ve created a pull request for a fix for this:
https://github.com/Redth/ZXing.Net.Mobile/pull/1028
@Softtinn: That’s the same workaround I am using meanwhile.