Flutter使用permission_handler,添加权限后获取权限仍然被拒

使用permission_handler,添加权限后获取权限仍然被拒 - 简书写flutter,需要添加获取一些权限,用到了permission_handler,然后在iOS的plist文件里也加了相关的权限配置,但是运行项目,没有权限提示.获取权限状态都是permanentlyDenied.

解决办法:

在podfile里加红框里面的这些东西:

 记得打开需要用到的权限的注释......

post_install do |installer|

    installer.pods_project.targets.each do |target|

    target.build_configurations.each do |config|

      # Here are some configurations automatically generated by flutter

      # You can remove unused permissions here

      # for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/permission_handler/ios/Classes/PermissionHandlerEnums.h

      # e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'

      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [

        '$(inherited)',

        ## dart: PermissionGroup.calendar

        # 'PERMISSION_EVENTS=0',

        ## dart: PermissionGroup.reminders

        # 'PERMISSION_REMINDERS=0',

        ## dart: PermissionGroup.contacts

        # 'PERMISSION_CONTACTS=0',

        ## dart: PermissionGroup.camera

        # 'PERMISSION_CAMERA=0',

        ## dart: PermissionGroup.microphone

        # 'PERMISSION_MICROPHONE=0',

        ## dart: PermissionGroup.speech

        # 'PERMISSION_SPEECH_RECOGNIZER=0',

        ## dart: PermissionGroup.photos

        # 'PERMISSION_PHOTOS=0',

        ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]

        # 'PERMISSION_LOCATION=0',

        ## dart: PermissionGroup.notification

        # 'PERMISSION_NOTIFICATIONS=0',

        ## dart: PermissionGroup.mediaLibrary

        # 'PERMISSION_MEDIA_LIBRARY=0',

        ## dart: PermissionGroup.sensors

        # 'PERMISSION_SENSORS=0', 

        ## dart: PermissionGroup.bluetooth

        # 'PERMISSION_BLUETOOTH=0'

      ]

    end

  end

end


 参考:

Flutter permission_handler ios获取不到权限_左丘梦凡的博客-CSDN博客

 Flutter插件permission_handler获取权限不正确,iOS获取不到权限的问题! - 简书

使用permission_handler,添加权限后获取权限仍然被拒 - 简书

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值