CLLocationManager startUpdatingLocation nicht funktioniert

So, ich bin jetzt immer mindestens Rückrufe mit dem folgenden code...

- (void)viewDidLoad {

[super viewDidLoad];
mapView=[[MKMapView alloc] initWithFrame:self.view.frame];
//mapView.showsUserLocation=TRUE;
mapView.delegate=self;
[self.view insertSubview:mapView atIndex:0];

NSLog(@"locationServicesEnabled: %@", [CLLocationManager locationServicesEnabled] ? @"YES":@"NO");
    CLLocationManager *newLocationManager = [[CLLocationManager alloc] init];
    [newLocationManager setDesiredAccuracy:kCLLocationAccuracyBest];
    [newLocationManager setDistanceFilter:kCLDistanceFilterNone];
    [self setLocationManager:newLocationManager];


[[self locationManager] setDelegate:self];
[[self locationManager] startUpdatingLocation];
NSLog(@"Started updating Location");

}


- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {

NSLog(@"Did update to location");
mStoreLocationButton.hidden=FALSE;
location=newLocation.coordinate;

MKCoordinateRegion region;
region.center=location;
MKCoordinateSpan span;
span.latitudeDelta=0.01;
span.longitudeDelta=0.01;
region.span=span;


[mapView setRegion:region animated:TRUE];


}

Kann ich die Haltepunkte in der zweiten Methode und NSLog ist die Berichterstattung ständige location updates, aber aus irgendeinem Grund ist der zoom mit span nicht funktioniert. Irgendeine Idee warum? Es hat meine Koordinaten und alles. Art kratzen meinen Kopf auf diese.

  • ur-code scheint ok.. problem ist smwhere anderes
  • Haben Sie diese Probleme in den simulator ? Haben Sie aktiviert die simulation des Standorts ?
  • Ja, simulator Probleme. Ich habe aktiviert-simulation Standort. Vielleicht brauche ich, um es zu testen auf einem Gerät.
InformationsquelleAutor Coltrane | 2012-07-28
Schreibe einen Kommentar