首页 > 解决方案 > 当我尝试从 Zxing 库中保存 QR 码时,BarcodeWriter 类出现错误

问题描述

目前我想将我生成的二维码作为图像存储在执行它的电话库中,然后几乎同时将其作为备份上传到亚马逊 AWS,但是当我尝试将我的二维码写为图像时出现错误。

代码:

private void WriteBarcode()
{
    ZXing.BarcodeWriter barcodeWriter = new ZXing.BarcodeWriter
    {
        Format = BarcodeFormat.QR_CODE
    };
    barcodeWriter
        .Write("some string data")
        .Save(@"C:\some path");
}

我看到的这段代码应该可以工作,但它标记了 BarcodeWriter 类中的错误,并且我安装了以下依赖项。

Zxing.net
Zxing.Net.Mobile 
Zxing.Net.Mobile.Forms 

错误

Gravedad Código 描述 Proyecto Archivo Línea Estado suprimido Error CS0305 El uso de tipo de tipo genérico 'BarcodeWriter'

用途:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Xamanimation;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using ZXing.Net.Mobile.Forms;
using ZXing.Mobile;

当我把 ZXing.Mobile.BarcodeWriter它给我一个错误并说它找不到那个命名空间

标签: c#xamarinxamarin.formsqr-codezxing

解决方案


推荐阅读