ios - Location Manager won't display latitude and longitude -
i have app displays longitude , latitude of users position. application asks current location, , latitude , longitude displays in xcode. in app, nothing happens.
here's code:
- (nsstring *)devicelocation { nsstring *thelocation = [nsstring stringwithformat:@"latitude: %f longitude: %f", locationmanager.location.coordinate.latitude, locationmanager.location.coordinate.longitude]; return thelocation; }
in viewdidload:
locationmanager = [[cllocationmanager alloc] init]; locationmanager.distancefilter = kcldistancefilternone; // whenever move locationmanager.desiredaccuracy = kcllocationaccuracyhundredmeters; // 100 m [locationmanager startupdatinglocation]; nslog(@"%@", [self devicelocation]);
the problem latitude , longitude -labels won't show position.
my guess you're not assigning view controller delegate cllocationmanager.
you can via:
locationmanager.delegate = self;
right after create locationmanager.
then, can update labels having view controller respond delegate method locationmanager:didupdatelocations:
.
Comments
Post a Comment