有没有一种简单的方法可以找到在 flutter 中使用权限的包? Info.plist 提交问题中缺少目的字符串

问题描述

在向 Apple 提交应用程序期间,我收到了以下 ITMS-90683:Info.plist 中缺少目的字符串的通知

NSBluetoothPeripheralUsageDescription
NSBluetoothAlwaysUsageDescription
NSLocationWhenInUseUsageDescription 

以前的问题与permission_handler 包有关,但使用文档中提供的脚本可以有效地排除包接触但应用程序未使用的权限。在更新了所有依赖项并添加了许多其他依赖项后,我发现自己被提示输入其他三个我实际上并不打算使用的权限。有没有一种快速方法来找到这些包中的哪一个去使用?如果不知道哪个包可能需要这些权限?

  Flutter:
    sdk: Flutter
  cupertino_icons: ^1.0.2
  Flutter_spinkit: ^5.0.0
  shared_preferences: ^2.0.4
  cached_network_image: 2.5.1
  cached_video_player: ^1.0.3
  rxdart: ^0.25.0
  Flutter_inappwebview: ^5.1.0+4
  sqflite: ^2.0.0+2
  path: ^1.8.0
  pull_to_refresh: ^1.6.4
  font_awesome_Flutter: ^8.12.0
  Flutter_svg: ^0.19.3
  purchases_Flutter: ^3.1.0
  url_launcher: ^6.0.2
  rFlutter_alert: ^2.0.2
  modal_progress_hud: ^0.1.3
  sizer: ^1.1.8
  permission_handler: ^6.1.0
  image_gallery_saver: ^1.6.8
  http: ^0.13.0
  path_provider: ^2.0.1
  onesignal_Flutter: ^3.0.0-beta1
  google_mobile_ads: ^0.11.0+3
  #Firebase dependencies
  firebase_core: ^1.0.1
  firebase_auth: ^1.0.1
  cloud_firestore: ^1.0.1
  firebase_crashlytics: ^1.0.0
  firebase_analytics: ^7.1.1 

我不想为我不打算使用的权限添加理由。 谢谢

编辑 1:我附上了permission_handler 请求的Podfile 部分。如自述文件中所示,我的应用实际使用的权限已被注释(照片和通知

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['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'

    # 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.photos
      # 'PERMISSION_PHOTOS=0',## dart: PermissionGroup.notification
      # 'PERMISSION_NOTIFICATIONS=0',## dart: [PermissionGroup.location,PermissionGroup.locationAlways,PermissionGroup.locationWhenInUse]
      'PERMISSION_LOCATION=0',## 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.mediaLibrary
      'PERMISSION_MEDIA_LIBRARY=0',## dart: PermissionGroup.sensors
      'PERMISSION_SENSORS=0'
    ]
    end
  end
end

EDIT 2:蓝牙权限是否可能是新的 Flutter 2.0.2 版的错误Flutter 在调试模式下,在 iOS 应用程序第一次启动时,它总是要求获得检测附近设备的权限(即使在我之前使用的 1.22 版本中)

解决方法

试试

## dart: PermissionGroup.bluetooth
'PERMISSION_BLUETOOTH=0'

最近添加到permission_handler GitHub 文档:https://github.com/Baseflow/flutter-permission-handler

,

他们也可以删除的另一个权限是:

## dart: PermissionGroup.photosAddOnly
'PERMISSION_PHOTOS_ADD_ONLY = 0',