F
fml
Neues Mitglied
Thread Starter
- Dabei seit
- 17.03.2010
- Beiträge
- 5
- Reaktionspunkte
- 0
Hi,
ich möchte gerne alle x Sekunden den aktuellen Standort abfragen.
getUpdated wird per NSTimer regelmäßig aufgerufen, das klappt auch wie es soll.
startUpdatingLocation klappt auch, nur wird didUpdateToLocation nie aufgerufen.
Wenn ich nun
benutze, kommen zwar locations an, allerdings bekommt man ja nicht jede Sekunde eine location, je nach GPS-Empfang auch mal schneller oder langsamer.
Was mache ich falsch?
ich möchte gerne alle x Sekunden den aktuellen Standort abfragen.
Code:
- (void)getUpdate {
[locationManager startUpdatingLocation];
hasUpdated = false;
while (!hasUpdated) {
sleep(1);
}
[locationManager stopUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:
(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
doSomething();
}
getUpdated wird per NSTimer regelmäßig aufgerufen, das klappt auch wie es soll.
startUpdatingLocation klappt auch, nur wird didUpdateToLocation nie aufgerufen.
Wenn ich nun
Code:
- (void)getUpdate {
[locationManager startUpdatingLocation];
hasUpdated = false;
sleep(1);
[locationManager stopUpdatingLocation];
}
benutze, kommen zwar locations an, allerdings bekommt man ja nicht jede Sekunde eine location, je nach GPS-Empfang auch mal schneller oder langsamer.
Was mache ich falsch?