रिटर्निंग MapKit Userlocation निर्देशांक

वोट
1

जब भी मैं अक्षांश / देशांतर निर्देशांक मेरे वर्तमान स्थान के लिए त्रुटि के कोई स्पष्टीकरण के साथ, अपने आवेदन दुर्घटनाओं वापस जाने के लिए प्रयास करें ...

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

मैं फोन के रूप में अच्छी तरह से स्थान पाता है जब तक इंतज़ार कर रहा हूँ ...

30/10/2009 को 21:58
का स्रोत उपयोगकर्ता
अन्य भाषाओं में...                            


2 जवाब

वोट
5

mapView.userLocation.location.coordinateएक struct जबकि %@फॉर्मेट स्पेसिफायर एक वस्तु की उम्मीद है। यह काम करेगा:

NSLog(@"%f, %f", mapView.userLocation.location.coordinate.latitude,
                 mapView.userLocation.location.coordinate.longitude);
30/10/2009 को 22:02
का स्रोत उपयोगकर्ता

वोट
0

किसी कारण से, यह मेरे लिए काम नहीं किया। यह मेरे निर्देशांक (0.0000, 0.0000) के लिए ले रहा है। यदि आप इसे बाहर की जाँच करने का मौका दिया नीचे मेरी कोड है। सहायता के लिए धन्यवाद!

[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];
20/12/2010 को 23:57
का स्रोत उपयोगकर्ता

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