ios - MKUserTrackingBarButtonItem Spinning After The App Is Disallowed To Use Current Location -


i have added instance of mkusertrackingbarbuttonitem in view controller's viewdidload follows:

mkusertrackingbarbuttonitem *usertrackingbutton = [[mkusertrackingbarbuttonitem alloc] initwithmapview:self->mapview]; nsmutablearray *toolbaritems = [[nsmutablearray alloc] initwitharray:[maptoolbar items]]; [toolbaritems insertobject:usertrackingbutton atindex:0]; [maptoolbar setitems:toolbaritems]; 

location services turned on in settings not app. when mkusertrackingbarbuttonitem button tapped, modal dialog asks user whether allow app use current location. when "don't allow" selected, mkusertrackingbarbuttonitem turns grey dashed spinning icon , original compass icon not restored.

how go restoring state of button done in maps app?

the desired behaviour same in maps app.

  1. ensure location services turned on in settings > privacy > location services.
  2. reset location & privacy in settings > general > reset > reset location & privacy.
  3. launch maps app.
  4. tap compass icon in lower left corner.
  5. a dialog message ""maps" use current location" appears. @ moment, compass icon has turned grey dashed spinning icon.
  6. choose "don't allow."

the original compass icon restored.

i testing on iphone , not on simulator. above code works without problem when location services turned on , app allowed use current location.

implement cllocationmanagerdelegate method :

- (void)locationmanager:(cllocationmanager *)manager didchangeauthorizationstatus:(clauthorizationstatus)status

and when clauthorizationstatus not kclauthorizationstatusauthorized can update usertrackingmode property of mkmapview mkusertrackingmodenone


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -