ios - Geo-Location error objective C -


i'm trying create app gather , display longitude , latitude values in labels have set in storyboard. if assign simple text labels in ibaction instance, runs fine , text displayed. however, when use code in ibaction instance below, nothing displayed in labels when press button.

  @interface viewcontroller ()  @end  @implementation viewcontroller {      cllocationmanager *locationmanager; }   @synthesize longitude, latitude;  - (void)viewdidload { [super viewdidload]; locationmanager = [[cllocationmanager alloc] init];     }  - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. }  - (ibaction)getcurrentlocation:(id)sender {    locationmanager.delegate = self;   locationmanager.desiredaccuracy = kcllocationaccuracybest;   [locationmanager startupdatinglocation];   }    - (void)locationmanager:(cllocationmanager *)manager                        didfailwitherror:(nserror *)error { nslog(@"didfailwitherror: %@", error); uialertview *erroralert = [[uialertview alloc]                            initwithtitle:@"error" message:@"failed    location" delegate:nil cancelbuttontitle:@"ok"    otherbuttontitles:nil]; [erroralert show]; }  - (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation { nslog(@"didupdatetolocation: %@", newlocation); cllocation *currentlocation = newlocation;  if (currentlocation != nil) {     longitude.text = [nsstring stringwithformat:@"%.8f", currentlocation.coordinate.longitude];     latitude.text = [nsstring stringwithformat:@"%.8f", currentlocation.coordinate.latitude]; }  } @end 


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -