flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

[Bug]: photos permission always denied on iOS 18.5

Open maaanueeelll opened this issue 6 months ago • 8 comments

Please check the following before submitting a new issue.

Please select affected platform(s)

  • [ ] Android
  • [x] iOS
  • [ ] Windows

Steps to reproduce

iOS version 18.5

I noticed that when checking the status of photos.request() I get always permission permanently denied even if the permission is granted.

Expected results

expected result permission granted

Actual results

permission permanently denied

Code sample

Code sample

final status = await Permission.photos.request(); if (status.isGranted) { debugPrint('Photos permission granted'); } else if (status.isDenied) { debugPrint('Photos permission denied'); } else if (status.isPermanentlyDenied) { debugPrint('Photos permission permanently denied'); openAppSettings();

Screenshots or video

Screenshots or video demonstration

[Upload media here]

Version

permission_handler: ^12.0.0+1

Flutter Doctor output

Doctor output

[✓] Flutter (Channel stable, 3.32.4, on macOS 15.5 24F74 darwin-arm64, locale en-IT) [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 16.4) [✓] Chrome - develop for the web [✓] Android Studio (version 2024.3) [✓] VS Code (version 1.101.0) [✓] Connected device (4 available) [✓] Network resources

• No issues found!

maaanueeelll avatar Jun 21 '25 07:06 maaanueeelll

Same problem here, it also happens with camera value too.

final cameraStatus = await Permission.camera.status;

response: PermissionStatus (PermissionStatus.denied)

if (!cameraStatus.isGranted) final results = await [ Permission.camera, ].request();

reponse: Permission (Permission.camera) -> PermissionStatus (PermissionStatus.permanentlyDenied)

alejandromotadev avatar Jun 25 '25 16:06 alejandromotadev

Did you happen to check "screen time" on setting?

I found that user can set

Screen Time > Content & Privacy Restrictions > Allowed Apps > Camera.

If your app use camera, you should check.

maggie-mob avatar Jun 28 '25 00:06 maggie-mob

Same issue on iOS, my code:

import 'package:permission_handler/permission_handler.dart';

class PermissionService {
  static Future<bool> get checkAndRequestCameraPermission async {
    final PermissionStatus status = await Permission.camera.status;
    if (status.isGranted) return true;

    final PermissionStatus result = await Permission.camera.request();
    return result.isGranted;
  }
}

always return false.

Barzi-Yassin avatar Jul 01 '25 03:07 Barzi-Yassin

Did you happen to check "screen time" on setting?

I found that user can set

Screen Time > Content & Privacy Restrictions > Allowed Apps > Camera.

If your app use camera, you should check.

camera on, still seeing the issue

alejandromotadev avatar Jul 01 '25 06:07 alejandromotadev

You should check the documentation regarding the podfile. Be sure you have implemented the correct settings. You can compare it with the documentation and the example project that has been supplied with the project.

Kind regards,

TimHoogstrate avatar Jul 02 '25 08:07 TimHoogstrate

I also encountered this issue on iOS 18.5. Here's my code:

plaintext

static Future<bool> checkCamera() async {
    PermissionStatus cameraStatus = await Permission.camera.status;
    final shouldRationale = await Permission.camera.shouldShowRequestRationale;
    print('cameraStatus:$cameraStatus-$shouldRationale');
    if (cameraStatus == PermissionStatus.granted) {
      return true;
    }
    return false;
  }

Steps to reproduce:

  1. After opening the app, when the permission prompt appears for the first time, select "Denied".
  2. Call the checkCamera method, which consistently returns cameraStatus: PermissionStatus.denied-false.
  3. Go to Settings > [App Name] > Camera, and enable the camera permission.
  4. Restart the app and call checkCamera again, which still returns cameraStatus: PermissionStatus.denied-false.

Notes:

But the camera can be accessed and used normally.

Screen Time restrictions are not enabled.

Image

Image

kuse95 avatar Jul 03 '25 07:07 kuse95

see https://github.com/Baseflow/flutter-permission-handler/tree/main/permission_handler

ensure your Podfile added the 'PERMISSION_CAMERA=1'

runoob-coder avatar Jul 14 '25 15:07 runoob-coder

+1, await Permission.mediaLibrary.status not Work on iOS 18.5

matovnikov avatar Jul 22 '25 12:07 matovnikov