xcode4.2 - I can't update location IOS -
i'm trying city name of location, use code:
- (void)viewdidload { [super viewdidload]; cllocationmanager *locationmanager =[[cllocationmanager alloc] init]; locationmanager.delegate = self; locationmanager.desiredaccuracy = kcllocationaccuracynearesttenmeters; [locationmanager startupdatinglocation]; // additional setup after loading view. } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } //implementamos los metodos delegados de cllocationmanager. - (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation { // creates mkreversegeocoder find placemark using found coordinates clgeocoder * geocoder = [[clgeocoder alloc] init]; [geocoder reversegeocodelocation:newlocation completionhandler:^(nsarray *placemarks, nserror *error) { nsstring * location = ([placemarks count] > 0) ? [[placemarks objectatindex:0] locality] : @"not found"; _ciudadlabel.text=location; }]; } // delegate method called if error occurs in locating current location - (void)locationmanager:(cllocationmanager *)manager didfailwitherror:(nserror *)error { nslog(@"locationmanager:%@ didfailwitherror:%@", manager, error); } but when execute application, message says if want allow location disapear , don't execute:
- (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation { // creates mkreversegeocoder find placemark using found coordinates clgeocoder * geocoder = [[clgeocoder alloc] init]; [geocoder reversegeocodelocation:newlocation completionhandler:^(nsarray *placemarks, nserror *error) { nsstring * location = ([placemarks count] > 0) ? [[placemarks objectatindex:0] locality] : @"not found"; _ciudadlabel.text=location; }]; } why location doesn't start?
thanks
Comments
Post a Comment