简体   繁体   English

Flutter 找不到模块barcode_scan;

[英]Flutter cannot find module barcode_scan;

i'm new to flutter and try to create a barcode app.我是新手,并尝试创建一个条形码应用程序。 To Scan barcodes i'm using this library: barcode_scan: "^0.0.4".要扫描条形码,我正在使用这个库:barcode_scan: "^0.0.4"。 On Android everything is working fine but xcode cannot find my module.在 Android 上一切正常,但 xcode 找不到我的模块。 I think i'm doing something wrong because some of my packages werent found only in xcode.我想我做错了什么,因为我的一些包只在 xcode 中找不到。 The way i added those dependencies was, i added the dependencies into my pubspec.yaml file like this:我添加这些依赖项的方式是,将依赖项添加到我的 pubspec.yaml 文件中,如下所示:

dependencies:
 flutter:
  sdk: flutter

 cupertino_icons: ^0.1.2
 barcode_scan: "^0.0.4"
 url_launcher:
 validators:
 flutter_launcher_icons: ^0.7.2

Afterwards i run pub get on android studio.之后我在 android studio 上运行 pub get。 Did i forgot something on the ios side?我忘记了 ios 方面的东西吗? My Project includes swift support.我的项目包括快速支持。 Thanks谢谢

To use on iOS, you must add the the camera usage description to your Info.plist要在 iOS 上使用,您必须将相机使用说明添加到您的 Info.plist

<dict>
    <!-- ... -->
    <key>NSCameraUsageDescription</key>
    <string>Camera permission is required for barcode scanning.</string>
    <!-- ... -->
</dict>

Also try to use the latest version of the barcode_scan plugin in your pubspec.yaml file:还可以尝试在 pubspec.yaml 文件中使用最新版本的 barcode_scan 插件:

dependencies:
    # ...
    barcode_scan: any

Latest version had some additional implementation works in Android.最新版本在 Android 中有一些额外的实现工作。 Check the official doc here此处查看官方文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM