Visszatérve Mapkit Userlocation koordinátái

szavazat
1

valahányszor megpróbál visszatérni a szélességi / hosszúsági koordinátákat a mostani helyét, a alkalmazás összeomlik magyarázat nélkül a hiba ...

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

Várom, amíg a telefon megtalálja a helyét, valamint ...

A kérdést 30/10/2009 21:58
a forrás felhasználó
Más nyelveken...                            


2 válasz

szavazat
5

mapView.userLocation.location.coordinateegy struct míg a %@formátumleíró elvárja egy tárgyat. Ez a munka:

NSLog(@"%f, %f", mapView.userLocation.location.coordinate.latitude,
                 mapView.userLocation.location.coordinate.longitude);
Válaszolt 30/10/2009 22:02
a forrás felhasználó

szavazat
0

Valamilyen oknál fogva ez nem működik nekem. Ez elvisz a koordinátákat (0,0000, 0,0000). Az alábbiakban a kód, ha van egy esélyt, hogy nézd meg. Köszönöm a segítséget!

[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];
Válaszolt 20/12/2010 23:57
a forrás felhasználó

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