Po návratu Mapkit Userlocation Souřadnice

hlasů
1

kdykoli se pokusí vrátit na délku / šířku souřadnic pro mé současné umístění, moje pády aplikací bez vysvětlení chyby ...

NSLog(@%@, mapView.userLocation.location.coordinate);

Čekám, až se telefon najde místo i ...

Položena 30/10/2009 v 21:58
zdroj uživatelem
V jiných jazycích...                            


2 odpovědí

hlasů
5

mapView.userLocation.location.coordinateJe struct zatímco %@formát specifikátor očekává objekt. To bude fungovat:

NSLog(@"%f, %f", mapView.userLocation.location.coordinate.latitude,
                 mapView.userLocation.location.coordinate.longitude);
Odpovězeno 30/10/2009 v 22:02
zdroj uživatelem

hlasů
0

Z nějakého důvodu, že to není práce pro mě. To mě brát na souřadnicích (0.0000, 0.0000). Níže je můj kód, pokud máte možnost podívat se na to. Děkuji za pomoc!

[mapView setMapType:MKMapTypeStandard];
    [mapView setZoomEnabled:YES];
    [mapView setScrollEnabled:YES];
    mapView.showsUserLocation=TRUE;

    MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };

    CLLocationCoordinate2D myCoord = {mapView.userLocation.location.coordinate.latitude,mapView.userLocation.location.coordinate.longitude};
    [mapView setCenterCoordinate:myCoord animated:YES];

    region.span.longitudeDelta = 0.01f;
    region.span.latitudeDelta = 0.01f;
    [mapView setRegion:region animated:YES]; 

    [mapView setDelegate:self];
Odpovězeno 20/12/2010 v 23:57
zdroj uživatelem

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more