Search code examples
iosflutterpermissionscamera

(Flutter) White screen upon denying camera permission in IOS


When I deny the camera permission, white screen occured in IOS(IPhone, IPad)

In Android, moved to previous page.

Is there any solution? There are no result about "how to solve white screen upon denying camera permission in IOS" while I searching


Solution

  • Getting Camera permission before using camera occurs the error so I edit the code, getting camera permission when I first enter the application, then I can avoid the error

    So I have to edit Podfile.

    Reference the link below: Flutter IOS camera permission not working for permission_handler package

    post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
            '$(inherited)',
    
            ## dart: PermissionGroup.camera
            'PERMISSION_CAMERA=1',
    
            ]
        end
        flutter_additional_ios_build_settings(target)
      end
    end
    
    #Default installer commented
    # post_install do |installer|
    #   installer.pods_project.targets.each do |target|
    #     flutter_additional_ios_build_settings(target)
    #   end
    # end
    
    1. Edit the Podfile
    2. Move to ios directory and then execute pod install then we can apply the editted Podfile