0

I'm using the multi_image_picker2 library. It is functioning fine, however there is no option to access camera or photo library (iOS specific here).Here is a snippet of my code:

import 'dart:typed_data';
import 'package:multi_image_picker2/multi_image_picker2.dart';

class ImagePickerFacade {
  Future<List<Asset>?> loadImage() async {
    try {
      var resultList = await MultiImagePicker.pickImages(
        maxImages: 300,
        enableCamera: true,
        cupertinoOptions: const CupertinoOptions(takePhotoIcon: "chat"),
      );
      if (resultList.isEmpty) {
        return null;
      } else {
        return resultList;
      }
    } on NoImagesSelectedException catch (e) {
      // User pressed cancel, update ui or show alert
      print(e);
    } on Exception catch (e) {
      // Do something
      print(e);
    }
  }
}

I have also included the following keys in my Info.plist file:

<key>NSCameraUsageDescription</key>
<string>App requires access to your phone camera.</string>
<key>NSMicrophoneUsageDescription</key>
<string>App requires access to your phone audio.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>App requires access to your phone photo library.</string>

I have tested my app using iOS 10, iOS 13, iOS 9 and the problem still persists. I also tried entering the keys above through XCode instead of manually through the Info.plist file, however nothing seems to work. This is what I currently see when the image picker pops up:

Screenshot of my simulated iPhone when the image picker prompt appears

Here is a link to the package I am using: https://pub.dev/packages/multi_image_picker2

Cheers

Fahim Parkar
  • 30,974
  • 45
  • 160
  • 276
  • Simulators are not providing you a Camera. That is why probably you do not see it. You need to test it with real device. Reference: https://stackoverflow.com/a/25486148/1744873 – salihgueler Feb 16 '22 at 07:19
  • I have tested it on my real device and still the same issue unfortunately - The device i tested it on was an iPhone SE from 2020. App works as expected - same functionality as the simulator but also same issue with the image picker. – Mika Siddiqui Feb 16 '22 at 07:22
  • Well, you are right. The issue seems to be there for a month. https://github.com/artflutter/multi_image_picker2/issues/11 – salihgueler Feb 16 '22 at 07:32

1 Answers1

0

You can use this package for picking multiple images, videos or any types https://pub.dev/packages/file_picker

Define a value for picked images

List<PlatformFile> images = [];

When you pressed button, gallery will open and you can choose image, video or file (if you want, you can pick multiple files).

RaisedButton(
  color: Colors.red,
  shape: RoundedRectangleBorder(
     borderRadius: BorderRadius.circular(5.0),
     side: BorderSide(
     color: Colors.yellow)),
  onPressed: () async {
     FilePickerResult result = await FilePicker.platform.pickFiles(
                                  allowMultiple: true,
                                  allowCompression: true,
                                  type: FileType.any,
                                );

     setState(() {
       model.images = result.files;
     });
  },
  child: Text(
    "Import Image/Video", style: TextStyle(
                                color: Colors.white,
                                fontWeight: FontWeight.w500),
  ),
 )
Vasseurr
  • 26
  • 1