【发布时间】:2019-01-09 20:10:06
【问题描述】:
我使用共享代码创建了一个新的 xamarin 项目。
我已经安装了 ZXing.Net.Mobile 和 ZXing.Net.Mobile.Forms nuget 包。我尝试了很多教程,但是当我调用扫描仪页面时它一直抛出异常。
这是我的代码:
private void Button_OnClicked(object sender, EventArgs e)
{
var scan = new ZXingScannerPage();
Navigation.PushAsync(scan);
scan.OnScanResult += Scan_OnScanResult;
}
private void Scan_OnScanResult(ZXing.Result result)
{
if (result != null)
{
Device.BeginInvokeOnMainThread(
async () =>
{
await Navigation.PopAsync(true);
MyCode.Text = result.Text;
});
}
}
知道如何让它在新的 xamarin 项目上运行吗? 我已经检查了 android manifest 中的相机。
【问题讨论】: