So the thing is that I need to call some function after user gives (or declines) a permission to use the microphone.
I already saw this:
[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
if (granted) {
// Microphone enabled code
[self someFunction];
}
else {
// Microphone disabled code
}
}];
However, this works only to detect current state.
If the current state is "no" and popup shows and user gives the permission - the function will not be called. That's because in the moment of executing this the permission was "no" and until we run the code next time the function will not be called.
What I want to do is to call a function after the user pressed either "allow" or "decline".
Anyone knows how to do this?
EDIT: Forgot to mention it has to be iOS 7.0 up compatible solution.