Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AVAudioSession requestRecordPermission with custom prompt?

I just installed the Square Register app on my iPhone 5S. When it first opened, it requested microphone access as expected, but what caught my eye was that it had a customized prompt explaining why it needed microphone access. I'm currently developing an app the requires microphone access and I'd like to be able to do this as well. The documentation for requestRecordPermission seems to suggest that there is no such option available. Did Apple give this developer special access to undocumented iOS 7 features, or am I missing something?

like image 430
Bradley Snyder Avatar asked Mar 07 '14 01:03

Bradley Snyder


2 Answers

Yes, there is... but for iOS7 and later...

in you app.plist add this key: NSMicrophoneUsageDescription and your desired customized prompt. More details here: https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW1

like image 159
TonyMkenu Avatar answered Sep 28 '22 03:09

TonyMkenu


in Xcode 8 and iOS 10 you should manually add

Privacy - Microphone Usage Description

to your plist file

like image 32
Rudi Avatar answered Sep 28 '22 05:09

Rudi