ios - How can I prompt the user to turn on location services after user has denied their use -


i have application explicit user interaction makes use of user's current location. if user denies access location services, still subsequent uses prompt user go settings , re-enable location services app.

the behavior want of built-in maps app:

  1. reset location warnings in settings > general > reset > reset location warnings.
  2. start maps app.
  3. tap current location button in lower left corner.
  4. maps prompts ""maps" use current location" | "don't allow" | "allow".
  5. choose "don't allow" option.
  6. tap current location button in lower left corner again.
  7. maps prompts "turn on location services allow "maps" determine location" | "settings" | "cancel".

in own app, same basic flow results in cllocationmanagerdelegate -locationmanager:didfailwitherror: method being called kclerrordenied error @ final step , user not given option open settings app correct it.

i display own alert in response error, not have ability launch settings app alert os can provide used built-in maps app.

is there in cllocationmanager class missing able give me behavior?

with ios8, can link user settings app via openurl. example, can create uialertview single button takes user settings app:

    uialertview *alert = [[uialertview alloc] initwithtitle:iclocalizedstring(@"locationservicespermissiontitle")                                                     message:iclocalizedstring(@"locationpermissiongeofencemessage")                                                    delegate:self                                           cancelbuttontitle:@"settings"                                           otherbuttontitles:nil];     [alert show]; 

in uialertview delegate:

- (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex {     [alertview dismisswithclickedbuttonindex:buttonindex animated:yes];     [[uiapplication sharedapplication] openurl: [nsurl urlwithstring: uiapplicationopensettingsurlstring]]; } 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -