IOS Location Update with NSTimer -
this question has answer here:
i want location updates once per second. interval important animation want create keep true-to-life speed on ground. understand [mylocationmanager startupdatinglocation] automatically poll "didupdatetolocations", not quite once per second.
is there way use nstimer location once per second?
thank -jj
- (void)startupdatinglocation self.locationmanager = [cllocationmanager new]; self.locationmanager.desiredaccuracy = kcllocationaccuracybestfornavigation; self.locationmanager.delegate = self; [self.locationmanager startupdatinglocation]; nstimer *timer = [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(updatelocation) userinfo:nil repeats:yes]; } - (void)updatelocation { cllocation location = self.locationmanager.location; // work here } #pragma mark - cllocationmanagerdelegate - (void)locationmanager:(cllocationmanager *)manager didupdatelocations:(nsarray *)locations { // nothing here }
Comments
Post a Comment