Flo*_*aal 6 uinavigationcontroller xamarin.ios zxing ios xamarin
因此,在我的应用程序开始时,用户必须能够扫描QR码.在应用程序设置中,用户可以扫描另一个条形码以更改设置中的某些数据.
在我的应用程序开始扫描仪工作正常,但当我尝试扫描settingsVC中的条形码时,我得到以下警告:
Warning: Attempt to present ZXing.Mobile.ZXingScannerViewController: 0x18036dc0 on UINavigationController: 0x16d8afe0 whose view is not in the window hierarchy!
Run Code Online (Sandbox Code Playgroud)
我已经尝试调用扫描viewDidAppear但是我得到了相同的警告.
button_ScanAPI.TouchUpInside += async (sender, e) => {
var scanner = new ZXing.Mobile.MobileBarcodeScanner ();
var result = await scanner.Scan ();
if (result != null) {
textField_APIKey.Text = result.Text;
}
};
Run Code Online (Sandbox Code Playgroud)
编辑:
试图使用没有异步的条形码扫描仪,但我仍然得到相同的消息.
var scanner = new ZXing.Mobile.MobileBarcodeScanner ();
scanner.Scan (true).ContinueWith (t => {
if (t.Result != null) {
InvokeOnMainThread (() => {
textField_APIKey.Text = t.Result.Text;
});
}
});
Run Code Online (Sandbox Code Playgroud)
我也尝试使用AVFoundation导致同样的错误:
Warning: Attempt to present <AVCaptureScannerViewController: 0x16fb1d00> on <UINavigationController: 0x16ebe790> whose view is not in the window hierarchy!
Run Code Online (Sandbox Code Playgroud)
EDIT2:
这是我的应用程序中的流程的一部分.

小智 5
我认为默认情况下,ZXing库必须寻找最顶级的NavigationController并尝试从那里呈现模态视图控制器.和你一样,我已经在根目录的顶部模拟地呈现了另一个NavigationController.我能够通过将构造函数更改为:
var scanner = new MobileBarcodeScanner (this);
var result = await scanner.Scan ();
Run Code Online (Sandbox Code Playgroud)
其中"this"是您实际调用扫描程序的ViewController.
| 归档时间: |
|
| 查看次数: |
1184 次 |
| 最近记录: |