54

Got a build rejection The app's Info.plist must contain an NSMicrophoneUsageDescription key with a string value explaining to the user how the app uses this data.

The app does not use microphone. Or so I think.

How do I track down where mic is used?

UPD23112016: given that the lazy answer is being upvoted I've filed a new feature request with apple to close this security hole.

UPD05042017: it is still bothersome that once you proxy mic access into some 3rd party framework via some half baked NSMicrophoneUsageDescription you have zero control on where and when it can be used if user agrees to allow mic access. Folks, please do due diligence and craft precise NSMicrophoneUsageDescription that reflects on the fact that the mic is used by the code that's completely outside of your control when the usage is obscured by a 3rd party binary-only framework. Thanks.

MultiColourPixel
  • 1,144
  • 10
  • 19
Anton Tropashko
  • 4,300
  • 3
  • 31
  • 53
  • 5
    I guess OP's questio is why the NSMicrophoneUsageDescription key is required when he is not asking for that permission anywhere. – Jakub Truhlář Sep 23 '16 at 09:24
  • Yes, you're right with your updated notes UPD05042017. The descriptions are mandatory for any content you or any frameworks you link against attempt to access. The errors are generated upon an attempt to access the content if a usage description was not supplied, so if you're getting those errors your app must be requesting them. You should discover why your app or its frameworks require these and add appropriate usage descriptions to your app's info.plist, or consider to remove that framework. – user8675 Sep 09 '18 at 21:38
  • I hear Apple saying - "if you want to use the hardware, you better get a handle on what you are doing, and not outsource the details to someone else's framework." – benc Jan 28 '19 at 18:54
  • which means in this particular case instabug has to be jettisoned out of your app since it's the user of the microphone – Anton Tropashko Jan 29 '19 at 12:01

6 Answers6

75

For the lazy:

if you want to quickly add usageDescriptions for most media access (on-device photos, camera, video recording, location):

right click your info.plist file and -> open as -> Source Code

then paste the following between the current values:

<key>NSMicrophoneUsageDescription</key>
<string>Need microphone access for uploading videos</string>
<key>NSCameraUsageDescription</key>
<string>Need camera access for uploading images</string>
<key>NSLocationUsageDescription</key>
<string>Need location access for updating nearby friends</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app will use your location to show cool stuffs near you.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Need photo library access for uploading images</string>

These descriptions, of course, are up to you. I tried to make them as generic as possible.

Hope this saves someone's time!

Elmo
  • 5,743
  • 15
  • 64
  • 132
Paul Lehn
  • 2,695
  • 20
  • 24
  • I feel like the descriptions are generic, but not technically accurate. For example: you don't need the mic to upload video, its to record the video (apparently you there is no way to do video on mute). I think the answer is solid, but did want to urge people adopting this template to think about the strings and also end-user test to make sure the experience and behavior are coherent. – benc Jan 28 '19 at 19:16
45

Just add NSMicrophoneUsageDescription key & in value add the justification that why your app is using Microphone. This is the latest requirement in iOS 10.

iYoung
  • 3,413
  • 3
  • 29
  • 56
19

And the culprit was (drums) : Instabug framework. They tell you right there on their marketware pages they allow users to take audio notes during feedback composition. So I've added NSMicrophoneUsageDescription into the app plist explaining that.

Note that there is a lot of apple API that instabug uses

Undefined symbols for architecture arm64: (i've removed some that seems legitimate according to what that framework claims to do and left what I see no claims for in the marketware)

"_AVMakeRectWithAspectRatioInsideRect", referenced from: +[IBGIAMImageAttachmentView sizeForContent:forWidth:] in InstabugHost_lto.o

"OBJC_CLASS$_CTTelephonyNetworkInfo", referenced from: objc-class-ref in InstabugHost_lto.o

"_AVNumberOfChannelsKey", referenced from: -[IBGVoiceNoteManager startRecording] in InstabugHost_lto.o

"_CTRadioAccessTechnologyHSDPA", referenced from: +[IBGInspector getCarrier] in InstabugHost_lto.o

"_CTRadioAccessTechnologyGPRS", referenced from: +[IBGInspector getCarrier] in InstabugHost_lto.o

"_CTRadioAccessTechnologyWCDMA", referenced from: +[IBGInspector getCarrier] in InstabugHost_lto.o

"_CTRadioAccessTechnologyEdge", referenced from: +[IBGInspector getCarrier] in InstabugHost_lto.o

"_CTRadioAccessTechnologyCDMA1x", referenced from: +[IBGInspector getCarrier] in InstabugHost_lto.o

"_CTRadioAccessTechnologyCDMAEVDORevA", referenced from: +[IBGInspector getCarrier] in InstabugHost_lto.o

"_CTRadioAccessTechnologyCDMAEVDORevB", referenced from: +[IBGInspector getCarrier] in InstabugHost_lto.o

"_CTRadioAccessTechnologyLTE", referenced from: +[IBGInspector getCarrier] in InstabugHost_lto.o

"OBJC_CLASS$_AVURLAsset", referenced from: OBJC_CLASS$_IBGAsset in InstabugHost_lto.o

"OBJC_METACLASS$_AVURLAsset", referenced from: OBJC_METACLASS$_IBGAsset in InstabugHost_lto.o

"_CTRadioAccessTechnologyCDMAEVDORev0", referenced from: +[IBGInspector getCarrier] in InstabugHost_lto.o

"_CTRadioAccessTechnologyHSUPA", referenced from: +[IBGInspector getCarrier] in InstabugHost_lto.o

ld: symbol(s) not found for architecture arm64

So in this post-Snowden world I have to wonder why does it need coretelephony, for example.

So what I'm getting at is that if you do not have the source the a 3rd party framework you have to disclose to the user that your app itself is NOT using microphone, or camera so that the user has an option of denying access to that device.

You don't want to be in the news someday due to some security flaw exploited via YOUR app.

Unresolved: The carefully crafted microphone usage description does not solve the issue with security completely though in case your app DOES use microphone and a 3rd party framework (think that it) needs it too. You'd have to craft a lengthy description outlining the risks.

Here's where credits disclosure could come handy giving users an idea which 3rd party code your are relying on. Give the credit where it's due :^)

If you are lazy such as myself and never read through the ios security whitepaper here's a short https://developer.apple.com/videos/play/wwdc2016/705/

In case you have no desire to watch the video in its entirety: around 19:00 mark the speaker tells you explicitly that you must not be lazy with those descriptions (you are responsible for a 3rd party code potentially abusing the permissions user has granted to your app. gotta love the binary frameworks ;^)

Anton Tropashko
  • 4,300
  • 3
  • 31
  • 53
12

iOS apps require the user to grant permission before accessing the Microphone. Trying to access it without user permission will lead to app crash.

To request user permission, we just need to add NSMicrophoneUsageDescription key in the info.plist file & and provide a value for this key. Value can be any string stating the applications need to access the microphone.

enter image description here

Sharath Kumar
  • 609
  • 3
  • 11
  • 25
5

Instabug uses NSMicrophoneUsageDescription to allow your users record a voice note about a bug or a feedback to you.

MEnnabah
  • 1,813
  • 1
  • 16
  • 35
2

Just having AVAudioSession.sharedInstance().requestRecordPermission() somewhere in your code base is enough to trigger this error with iTunes Connect. It's not even necessary to actively call that code!

bfx
  • 739
  • 7
  • 15