iphone - locationManager:didUpdateLocations: always be called several times -


i start updating current location when view did appear, , stop updating location whenever locationmanager:didupdatelocations: called. why locationmanager:didupdatelocations: called several times? have missed?

#import "viewcontroller.h"  @interface viewcontroller (){     cllocationmanager *locationmanager; // location manager current location } @end  @implementation viewcontroller - (void)viewdidload {     [super viewdidload]; }  - (void)viewdidappear:(bool)animated {     [super viewdidappear:animated];     [self startupdatingcurrentlocation]; }  - (void)startupdatingcurrentlocation {     if (!locationmanager)     {         locationmanager = [[cllocationmanager alloc] init];         [locationmanager setdelegate:self];         locationmanager.distancefilter = 10.0f; // don't need more accurate 10m     }     [locationmanager startupdatinglocation]; }  -(void)locationmanager:(cllocationmanager *)manager didupdatelocations:(nsarray *)locations{     [locationmanager stopupdatinglocation]; } @end 

probably depends accuracy set locationmanager. have 3 kinds o localization cell radio, wifi map, gps. if set best accuracy location manager continue check position, if location better accuracy out of range of distance filter delegate method called again.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -