android - Flutter multi_image_picker相机选项未在iOS中显示。当我已经启用摄像头并将权限写入info.plist中时

标签 android ios flutter dart imagepicker

它只显示最近的照片。我也想要相机选项。
这是我的代码。

  Future<void> loadAssets(StateSetter setModalState) async {
    print("On pressed");
    List<Asset> resultList = List<Asset>();
    String error = 'No Error Dectected';

    try {
      resultList = await MultiImagePicker.pickImages(
        maxImages: 2,
        enableCamera: true,
        selectedAssets: image,
        materialOptions: MaterialOptions(
          actionBarColor: "#abcdef",
          actionBarTitle: "Example App",
          allViewTitle: "All Photos",
          useDetailsView: false,
          selectCircleStrokeColor: "#000000",
        ),
      );
    } on Exception catch (e) {
      error = e.toString();
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setModalState(() {
      image = resultList;
      print("Set state");
      if(image.length>0){
        showUploadButton = false;
      }else{
        showUploadButton = true;
      }

     // _error = error;
      //print(_error);
    });
  }
我不知道为什么会这样。我已经删除了该应用程序并重新安装。还清理了android studio。但是它仍然只显示最近的照片

最佳答案

写在info.plist中

    <key>NSPhotoLibraryUsageDescription</key>
    <string>This app requires access to the photo library.</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>This app does not require access to the microphone.</string>
    <key>NSCameraUsageDescription</key>
    <string>This app requires access to the camera.</string>
enter image description here

关于android - Flutter multi_image_picker相机选项未在iOS中显示。当我已经启用摄像头并将权限写入info.plist中时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64347247/

相关文章:

android - Mobile Firemonkey 应用本地化

php - 如何使用 CSRF token 发布到 Laravel API?

flutter - FIREBASE_MESSAGING : onBackgroundMessage not handling notification when app is on Background or Terminated

安卓 : how can I store an audio file in the application folder

android - 如果没有验证证明、 session 信息、临时证明或注册 ID,则无法创建 PhoneAuthCredential。(导致 firebase 新更新)

ios - 为什么我在 Storyboard tableViewHeader 中的 View 在视觉上错位了?

ios - swift:从自定义应用程序加载时,iCloud 文档似乎被禁用

ios - 库胖文件不起作用

flutter - 为什么升级到 Flutter 1.7 会出错?

flutter - 如何在Flutter中使用flutter_bloc自动刷新上一页(第一页)