flutter-permission-handler
                                
                                 flutter-permission-handler copied to clipboard
                                
                                    flutter-permission-handler copied to clipboard
                            
                            
                            
                        [Bug]: Camera is Already Granted But Camer.status always return denied.
Please check the following before submitting a new issue.
- [ ] 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
1 . Call Permission.camer.request(); 2 . Check Status after request
Expected results
The result should show permission is granted
Actual results
The result that's function status return denied
Code sample
Code sample
await Permission.camera.request();    
PermissionStatus permissionStatus = await Permission.camera.status; 
if (permissionStatus.isDenied || permissionStatus.isPermanentlyDenied) {
  isCamera = true;
}  
Screenshots or video
Screenshots or video demonstration
[Upload media here]
Version
11.1.0
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.16.5, on macOS 14.2.1 23C71 darwin-arm64, locale en-KH)
    • Flutter version 3.16.5 on channel stable at /Users/kungchantha/Developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 78666c8dc5 (3 weeks ago), 2023-12-19 16:14:14 -0800
    • Engine revision 3f3e560236
    • Dart version 3.2.3
    • DevTools version 2.28.4
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/kungchantha/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C65
    • CocoaPods version 1.14.3
[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
[✓] VS Code (version 1.76.0)
    • VS Code at /Users/kungchantha/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.80.0
I already follow all config but the result is incorrect.
We're also seeing this on iOS 17. No matter what the status, it is always returned as denied
fyi, clearing my pods folder and .symlinks and rerunning pod install seems to have fixed the issue for me
I have got the same issue with ios. Always getting the status PermissionStatus.permanentlyDenied.
Any workaround?
We're seeing the same issue, on iOS physical device and on simulator. await Permission.camera.request() returns isPermanentlyDenied instantly, without ever asking the user to allow camera use. And because that request is never sent to the OS, you can't enable the camera in the iOS settings menu for that app either.
The temporary workaround that "worked" for us was to ignore the isPermanentlyDenied status entirely and just open the camera anyway - the operating system provided the popup to allow camera that we were looking for. But now we can't distinguish between a true isPermanentlyDenied status and one where the user simply hasn't been asked.
Same issue, and I have updated to lastest version of this lib. Any update?
It seem like we need to add the below code in Podfile.
Start of the permission_handler configuration
target.build_configurations.each do |config|
  config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
    '$(inherited)',
    ## dart: PermissionGroup.calendar
    # 'PERMISSION_EVENTS=1',
    ## dart: PermissionGroup.reminders
    # 'PERMISSION_REMINDERS=1',
    ## dart: PermissionGroup.contacts
    # 'PERMISSION_CONTACTS=1',
    ## dart: PermissionGroup.camera
    'PERMISSION_CAMERA=1',
    ## dart: PermissionGroup.microphone
    # 'PERMISSION_MICROPHONE=1',
    ## dart: PermissionGroup.speech
    # 'PERMISSION_SPEECH_RECOGNIZER=1',
    ## dart: PermissionGroup.photos
    # 'PERMISSION_PHOTOS=1',
    ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
    # 'PERMISSION_LOCATION=1',
      
    ## dart: PermissionGroup.notification
    # 'PERMISSION_NOTIFICATIONS=1',
    ## dart: PermissionGroup.mediaLibrary
    # 'PERMISSION_MEDIA_LIBRARY=1',
    ## dart: PermissionGroup.sensors
    # 'PERMISSION_SENSORS=1',   
       
    ## dart: PermissionGroup.bluetooth
    # 'PERMISSION_BLUETOOTH=1',
    ## dart: PermissionGroup.appTrackingTransparency
    # 'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
    ## dart: PermissionGroup.criticalAlerts
    # 'PERMISSION_CRITICAL_ALERTS=1'
  ]
end
You need to add this inside post_install as below:
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target)
# Start of the permission_handler configuration
target.build_configurations.each do |config|
  config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
    '$(inherited)',
    ## dart: PermissionGroup.calendar
    # 'PERMISSION_EVENTS=1',
    ## dart: PermissionGroup.reminders
    # 'PERMISSION_REMINDERS=1',
    ## dart: PermissionGroup.contacts
    # 'PERMISSION_CONTACTS=1',
    ## dart: PermissionGroup.camera
    'PERMISSION_CAMERA=1',
    ## dart: PermissionGroup.microphone
    # 'PERMISSION_MICROPHONE=1',
    ## dart: PermissionGroup.speech
    # 'PERMISSION_SPEECH_RECOGNIZER=1',
    ## dart: PermissionGroup.photos
    # 'PERMISSION_PHOTOS=1',
    ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
    # 'PERMISSION_LOCATION=1',
      
    ## dart: PermissionGroup.notification
    # 'PERMISSION_NOTIFICATIONS=1',
    ## dart: PermissionGroup.mediaLibrary
    # 'PERMISSION_MEDIA_LIBRARY=1',
    ## dart: PermissionGroup.sensors
    # 'PERMISSION_SENSORS=1',   
       
    ## dart: PermissionGroup.bluetooth
    # 'PERMISSION_BLUETOOTH=1',
    ## dart: PermissionGroup.appTrackingTransparency
    # 'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
    ## dart: PermissionGroup.criticalAlerts
    # 'PERMISSION_CRITICAL_ALERTS=1'
  ]
end 
end end
Dear @Chantha123, and the others,
I cannot reproduce this on the example app. Please be sure that you added the configuration like @rohnsht. If you still encounter any issues feel free to add information to this issue. Or start a new issue.
Kind regards,
Without additional information, we are unfortunately not able to resolve this issue. Therefore, we reluctantly closed this issue for now. If you run into this issue later, feel free to file a new issue with a reference to this issue. Add a description of detailed steps to reproduce, expected and current behaviour, logs and the output of 'flutter doctor -v'. Thanks for your contribution.
我在ios上也有同样的问题。始终获得PermissionStatus.permanentlyDenied状态。
How did you solve it