Ich bin seit Tagen auf diesem festgefahren und habe mich gefragt, ob jemand irgendwelche Hinweise hatte? Sollte einfach sein, aber es hat mich festgefahren! Ich bekomme meinen Standort und fahre fort. Aber ich möchte IN DIESER METHODE - LOOPING - bleiben, bis ich einen gültigen Ort bekomme. Dann Ladeansicht. DANKE für irgendwelche Tipps!loadview NUR, wenn ich meine GPS-Position bekomme
Ich bin mit dem Standard:
- (id)init
{
if (self = [super init])
{
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
self.locationManager.delegate = self; // send loc updates to myself
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[self.locationManager startUpdatingLocation];
}
return self;
}
- (void)viewDidLoad
{
// do my processing here ONLY when I get a valid location***************************
// and if I never get a valid location, then just go to my last location.
}
(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSDate* eventDate = newLocation.timestamp;
NSTimeInterval howRecent = [eventDate timeIntervalSinceNow];
if (abs(howRecent) < 5.0)
{
[manager stopUpdatingLocation]
printf("latitude %+.6f, longitude %+.6f\n", newLocation.coordinate.latitude, newLocation.coordinate.longitude);
}
}