objective c - Checking for iOS Location Services -


i have view map , button (like maps app once) allows user center , zoom current location on map. if can not use locationservicesenabled method (always returns yes), should create bool attribute check if didfailwitherror method called , know if can call button method?

thanks reading.

edited:

this code not work me. using simulator. getting yes when asking locationservicesenabled.

// gets user present location. - (ibaction)locateuser:(id)sender {      if([cllocationmanager locationservicesenabled]) {          cllocationcoordinate2d coordinate;          coordinate.latitude = self.mapview.userlocation.location.coordinate.latitude;         coordinate.longitude = self.mapview.userlocation.location.coordinate.longitude;          [self zoomcoordinate:coordinate];     } else {         [[[[uialertview alloc] initwithtitle:@"warning." message:@"location services disabled."                                      delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil] autorelease] show];          } } 

in preferences have 2 options disable location services. first option global switch disable location service apps "[cllocationmanager locationservicesenabled]". second option let disable location service apps not apps.

to check if disabled globally , if disabled app use following:

if([cllocationmanager locationservicesenabled] &&     [cllocationmanager authorizationstatus] != kclauthorizationstatusdenied) { ... } 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -