Reputation: 75
I need to create a custom ui for mic permission, is there a way to do it.
below is code code how permission block works.. it seems difficult with this call? App Shazam is doing it.
[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted){
if (granted) {
NSLog(@"granted");
} else {
NSLog(@"denied");
}}];
Upvotes: 2
Views: 1591
Reputation: 7484
I am not aware of any way that you can circumvent the UIAlertViews
presented by Apple that ask the user for permissions. What you can do however is this:
This approach is better than to always use the system's permission dialogue right away, as this can usually only be denied once from within the app. Using a custom view before the alert view allows you to ask more often.
We have also published a framework to help you with that: https://github.com/iosphere/ISHPermissionKit
Upvotes: 7
Reputation: 7667
For iOS >= 7.0
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
Upvotes: 1