The requestRecordPermission function memorize user's first time choice & it doesn't show the granting record permission alert if user has previously denied recording permission.
How can I always pop up the granting recording permission alert if previously user denied recording permission?
[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
if (!granted) {
// Microphone permission is not granted previously,
// How to pop up granting alert/dialog again?
// (My app supports iOS 7 and above)
}
}];
I know how to detect whether the permission is granted or not, my question is about after recording(microphone) permission has been denied once, how can I present the granting permission alert again to user?
(My app needs to support iOS7 and above)
Actually it's not possible to show permission alert again!
check out this SO post:
Request permissions again after user denies...
It says-
The OS will only ever prompt the user once. If they deny permission, that's it.
Following the Apple guidelines, you should simply show a message to the user explaining why he can't use the record feature.
A simple "How to enable my record permission" will do the job :)
Related
Can I register my Swift app to an OS notification about location permission change?
For example, let's say that the current state is denied and then the user is switching to the settings and change the permission to always and then opens my app again. Can I tell that my user had changed the permission and get both the old and the new one or is it too much to ask :) ?
Something like ABAddressBookRef ntificationaddressbook = ABAddressBookCreate(); ABAddressBookRegisterExternalChangeCallback(ntificationaddressbook, MyAddressBookExternalChangeCallback, self);
NOTE: My questions is not a duplicate of questions asking HOW to detect if the user has denied access.
I saw a lot of code on HOW to detect if the user has given access to the camera, but I'd need to know WHEN the user denies access.
My scenario is the next:
User opens view A, A asks for access to the camera, pop up appears, user denies access, user is redirected to B.
Is this possible?
Actually, there's a way of doing it:
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
if(granted){
NSLog(#"Granted access");
} else {
NSLog(#"Not granted access");
}
}];
As of now you can use applicationWillResignActive: and applicationDidBecomeActive:, verify whether the AVAuthorizationStatus's been changed and do whatever is needed. This isn't a future-proof solution, as the new iOS versions might not bring the app to background when asking for camera permissions, however any modifications to UIAlertView are even worse for that matter.
My app uses the location as well as the contacts. They are the bread and butter of my app. If the user does not allow both or any one of the accesses, the app will malfunction. I recently came to know that the dialog popup which pops up when the app tries to get the location o
r contact information cant be avoided.
iOS- How to avoid the dialog "Would like to use your current location"
Hence I am thinking of restructuring the app where during the setup stage, I wish to ask for these access.
If the user selects "Don't Allow", I wish to either terminate the app or post info to the user stating that to proceed with the next step you need to enable the app to get these info.
Is there a code to read the button press "Dont Allow" or "ÖK". Also, how to launch this dialog on a first place. Could anyone please let me know. Thanks
As per apple guidelines the alert which is shown to user cant be avoided , user has option to allow or cancle ,
What you can do is if your has not allowed the api to detect the location , you can show an alert to user saying "please go to settings and turn on the location services to use this feature/function"
this way user knows that if he want to use the feature he has to allow the services
// use folling code
Hi You can use below code snippet to check if location services are disabled by user and present a popop if([CLLocationManager locationServicesEnabled] &&
[CLLocationManager authorizationStatus] != kCLAuthorizationStatusDenied)
{
// location services are enabled
}
else
{// location services are disabled so enable them
UIAlertView *alert=[[[UIAlertView alloc]initWithTitle:#"Notification" message:#"Kindly enable the Location services needed to use this functionality in settings" delegate:self cancelButtonTitle:#"OK" otherButtonTitles:, nil]];
[alert show];
}
The Apple documentation for AVAudioSession Class Reference displays the following about the "requestRecordPermission:" method:
…… This method always returns immediately: if the user has previously
granted or denied recording permission, it executes the block when
called; otherwise, it displays an alert and executes the block only
after the user has responded to the alert.
That is clear,but my problem is this: How can I get back (for testing purposes) to the situation where the user has not yet granted or denied recording permission? I tried to completely remove the app from the device but it did not work.
You have to reset location and privacy.
Settings -> General -> Reset -> Reset Location & Privacy
It seems that once the user has denied the application permission to locate her on the map, any subsequent call to [locationManager startUpdatingLocation] will fail, but will not automatically prompt the user to set the correct permission in the settings as the iPhone map app does.
Is this behavior intended on iOS6, or is there a way to force MapKit to ask the user again for permission to use her location?
This behavior is intended. Once the user denied the permission then you can't ask it each time your app starts, if it do it'll be very annoying to user.
If user wants to give permission later, he need to go to settings app and set the necessary permission.
It's same for all type of permissions like location service, push notification, contact permission, photolibrary etc.
You should use the delegate method locationManager:didFailWithError: and look for a kCLErrorDenied.