⚠️

【Flutter】iOSで NSMicrophoneUsageDescription info.plist で警告メール⚠️

2024/04/13に公開

概要

「マイク録音の機能」を実装してないのに、「マイク利用の理由をinfo.plist記載して」

警告メールが来ていたので対応。

(※マイク機能を利用している場合は、
「info.plist」に「NSMicrophoneUsageDescription」追加し、説明文を追記でOK)

調査結果

利用しているパッケージ内部で、「マイク録音」のAPIがデフォルトで利用する設定とのこと。

Using the default configuration, the App Store will detect that your app uses the AVAudioSession API which includes a microphone API, and for privacy reasons it will ask you to describe your app's usage of the microphone. If your app does indeed use the microphone, you can describe your usage by editing the Info.plist file as follows:

対応

自分の環境だと、2つのパッケージで「マイク録音」利用がONの設定だったため、Podfileで、OFF設定を2つ追記で、対応できた。

Podfileに追記

ポイントとしては、下記2点

  • 'AUDIO_SESSION_MICROPHONE=0', // just_audio側の「マイク利用のOFF」設定
  • 'PERMISSION_MICROPHONE=0' // PermissionHandler側の「マイク利用のOFF」設定
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)',
        'AUDIO_SESSION_MICROPHONE=0',
        'PERMISSION_MICROPHONE=0'
      ]
    end
  end
end

備考

別の対応としては、マイク利用してないが「info.plist」にキー名と説明文を追加してやり過ごすことも考えたが、Issueにコメントがあって、ちゃんと対応できて助かった😺

AppleからのWarningメール

Please correct the following issues and upload a new binary to App Store Connect.

ITMS-90683: Missing purpose string in Info.plist - Your app’s code references one or more APIs that access sensitive user data, or the app has one or more entitlements that permit such access. The Info.plist file for the “Runner.app” bundle should contain a NSMicrophoneUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. If you’re using external libraries or SDKs, they may reference APIs that require a purpose string. While your app might not use these APIs, a purpose string is still required. For details, visit: https://developer.apple.com/documentation/uikit/protecting_the_user_s_privacy/requesting_access_to_protected_resources.

Apple Developer Relations

Discussion