[Bug]: photos permission always denied on iOS 18.5
Please check the following before submitting a new issue.
- [x] I have searched the existing issues.
- [x] I have carefully read the documentation and verified I have added the required platform specific configuration.
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!
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)
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.
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.
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
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,
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:
- After opening the app, when the permission prompt appears for the first time, select "Denied".
- Call the checkCamera method, which consistently returns cameraStatus: PermissionStatus.denied-false.
- Go to Settings > [App Name] > Camera, and enable the camera permission.
- 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.
see https://github.com/Baseflow/flutter-permission-handler/tree/main/permission_handler
ensure your Podfile added the 'PERMISSION_CAMERA=1'
+1, await Permission.mediaLibrary.status not Work on iOS 18.5