我是靠谱客的博主 美好口红,这篇文章主要介绍Flutter 使用Permission.microphone.request().isGranted ,申请麦克风使用权限失败,现在分享给大家,希望可以做个参考。

最近在项目中使用 permission_handler 这个组件中的

复制代码
1
2
Permission.microphone.request().isGranted

方法申请麦克风的使用权限时,在Android上可以实现,但是在iOS下会遇到失败的情况。解决方法如下:

  1. 在Podfile文件中添加如下内容:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ '$(inherited)', 'PERMISSION_MICROPHONE=1', ] end end end
  1. 执行 pod install

最后

以上就是美好口红最近收集整理的关于Flutter 使用Permission.microphone.request().isGranted ,申请麦克风使用权限失败的全部内容,更多相关Flutter内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(78)

评论列表共有 0 条评论

立即
投稿
返回
顶部