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.
- ensure location services turned on in settings > privacy > location services.
- reset location & privacy in settings > general > reset > reset location & privacy.
- launch maps app.
- tap compass icon in lower left corner.
- a dialog message ""maps" use current location" appears. @ moment, compass icon has turned grey dashed spinning icon.
- 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
Post a Comment