Monday, May 6, 2024
HomeiOS DevelopmentUnable to Entry Digicam or Gallery on iOS Utilizing Flutter

Unable to Entry Digicam or Gallery on iOS Utilizing Flutter


Hey Flutter Group,

I’m experiencing a problem with my Flutter app the place I’m unable to entry the digital camera or gallery on iOS units. The identical performance is working superb on Android. The app doesn’t crash nor reveals any error messages once I try and entry these options; it merely doesn’t reply to the permission request or the motion to select a picture.

Atmosphere:

Flutter model: 3.19.5
permission_handler model: 11.3.1
iOS model: 17

Code Implementation:

Permission Request:

Future<void> requestPermission() async {
  PermissionStatus standing = await Permission.digital camera.standing;
  if (!standing.isGranted) {
    await Permission.digital camera.request();
  }
  standing = await Permission.photographs.standing;
  if (!standing.isGranted) {
    await Permission.photographs.request();
  }
}

Picture Selecting:

void pickImage() async {
  ultimate pickedImage = await ImagePicker().pickImage(supply: ImageSource.digital camera);
  if (pickedImage != null) {
    // Course of picture
  }
}

Information.Plist

<?xml model="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist model="1.0">
    <dict>
        <key>CFBundleDevelopmentRegion</key>
        <string>$(DEVELOPMENT_LANGUAGE)</string>
        <key>CFBundleDisplayName</key>
        <string>5 Digtis Answer</string>
        <key>CFBundleExecutable</key>
        <string>$(EXECUTABLE_NAME)</string>
        <key>CFBundleIdentifier</key>
        <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <string>five_digtis_solution</string>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleShortVersionString</key>
        <string>$(FLUTTER_BUILD_NAME)</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>$(FLUTTER_BUILD_NUMBER)</string>
        <key>LSRequiresIPhoneOS</key>
        <true/>
        <key>UILaunchStoryboardName</key>
        <string>LaunchScreen</string>
        <key>UIMainStoryboardFile</key>
        <string>Major</string>
        <key>UISupportedInterfaceOrientations</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
        <key>UISupportedInterfaceOrientations~ipad</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationPortraitUpsideDown</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
        <key>NSPhotoLibraryUsageDescription</key>
        <string>Our app wants entry to your picture library to select photographs.</string>
        <key>NSPhotoLibraryAddUsageDescription</key>
        <string>Our app wants entry to your picture library to avoid wasting photographs.</string>
        <key>NSCameraUsageDescription</key>
        <string>Our app wants entry to your digital camera to take photographs.</string>
        <key>CADisableMinimumFrameDurationOnPhone</key>
        <true/>
        <key>UIApplicationSupportsIndirectInputEvents</key>
        <true/>
    </dict>
</plist>


Problem Description:
After I set off the motion to select a picture, there aren’t any errors logged within the console, and no permissions dialog is proven on iOS. The button press doesn’t lead to any seen motion or log output.

Troubleshooting Achieved:

  1. Confirmed entries in Information.plist for digital camera and picture library entry.
  2. Checked console logs by way of Xcode, no related errors displayed.
  3. Examined on a number of iOS units.
  4. Ran flutter clear and rebuilt the app.
  5. Permissions request code executes, however does not appear to immediate on iOS.

Questions:

  1. Might there be a problem with how permissions are dealt with particularly on iOS with Flutter?
  2. Is there a identified difficulty with permission_handler or ImagePicker on sure iOS variations?
  3. Any options on extra debugging steps or configurations I is perhaps lacking?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments