App crash even after adding NSMicrophoneUsageDescription in info.plist file swift iOS

1.7k views Asked by At

The info.plist file contains the following lines of code:

<key>NSMicrophoneUsageDescription</key> <string>The microphone permission is needed to to receive voice commands.</string>

Still getting the following error:

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSMicrophoneUsageDescription key with a string value explaining to the user how the app uses this data.

Any help would be greatly appreciated. Thanks

1

There are 1 answers

0
Marjan Basiri On

Double check if you have add in the correct info.plist!!

In the first image, info.plist is used for UnitTest, And in the second image the info.plist is for the main project.

So just check if you've add the "NSMicrophoneUsageDescription" in the main info.plist.

It is obvious that if you have UnitTest you must also add the key to the other info.plist(First Image).

This info.plist is used for UnitTest

enter image description here