0

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

Community
  • 1
  • 1
Timothy Rajan
  • 1,947
  • 8
  • 38
  • 62
  • Don't terminate your app under any conditions, especially these. If your app really can't function without Location Services, just display a modal view with some text that explains to the user why. – Shaggy Frog Dec 12 '13 at 07:56

1 Answers1

1

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]; }

amrut1
  • 124
  • 10
  • Thanks for the info. Can you provide me a code snippet to detect the user choice when presented with the dialog. Thanks – Timothy Rajan Dec 12 '13 at 08:01