mintware-de / flutter_barcode_reader

A flutter plugin for reading 2D barcodes and QR codes.
MIT License
628 stars 463 forks source link

PlatformException(PERMISSION_NOT_GRANTED, null, null) #63

Closed lijunen2009 closed 4 years ago

lijunen2009 commented 5 years ago

my code try { String barcode = await BarcodeScanner.scan();

  return {
    'status':200,
    'msg':'扫码成功',
    'result':barcode
  };
} on PlatformException catch (e) {
  print(e);
  if (e.code == BarcodeScanner.CameraAccessDenied) {
    return {
      'status':200,
      'msg':'没有相机权限',
      'result':''
    };

  } else {
    return {
      'status':200,
      'msg':'未知错误:${e.toString()}',
      'result':''
    };

  }
} on FormatException{
  return {
    'status':200,
    'msg':'用户取消',
    'result':''
  };
} catch (e) {
  return {
    'status':200,
    'msg':'未知错误:${e.toString()}',
    'result':''
  };
}

}

Runner/info.plist

NSCameraUsageDescription
<string>App需要您的同意,才能访问相机</string>

call get error flutter: PlatformException(PERMISSION_NOT_GRANTED, null, null)

alsocalledchris commented 5 years ago

I also get this error, even if I use a different plugin to grant permission first - this does not see granted permission and errors with the PlatformException(PERMISSION_NOT_GRANTED, null, null)

hoangcao10 commented 5 years ago

same error

jeidison commented 5 years ago

https://stackoverflow.com/questions/25486080/how-to-access-ios-simulator-camera

karedem commented 4 years ago

base on MTBBarcodeScanner , hope return more infomation when grant permission failed,

devtronic commented 4 years ago

Unfortunately, the iOS simulator does not support camera features.