Google Maps API: Erste-Koordinaten der aktuellen Position iOS

Ich arbeite derzeit mit der Google Maps API in mein Projekt. Ich bin versucht, die Standard-Kamera/zoom, um die Benutzer-Speicherort. Ich mache Folgendes:

@implementation ViewController{

GMSMapView *mapView_;

}
@synthesize currentLatitude,currentLongitude;

- (void)viewDidLoad
{
[super viewDidLoad];
mapView_.settings.myLocationButton = YES;
mapView_.myLocationEnabled = YES;


}
- (void)loadView{

CLLocation *myLocation = mapView_.myLocation;

GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(myLocation.coordinate.latitude, myLocation.coordinate.longitude);
marker.title = @"Current Location";
marker.map = mapView_;
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:myLocation.coordinate.latitude
                                                        longitude:myLocation.coordinate.longitude
                                                             zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];

self.view = mapView_;
   NSLog(@"%f, %f", myLocation.coordinate.latitude, myLocation.coordinate.longitude);

}

Jedoch funktioniert es nicht, da wenn ich

NSLog(@"%f, %f", myLocation.coordinate.latitude, myLocation.coordinate.longitude);

gibt es 0, 0, und es gibt nicht den aktuellen Standort-Koordinaten. Wie kann ich richtig erhalten die Nutzer die Koordinaten?

  • Was ist diese Zeile tun ? CLLocation *myLocation = mapView_.myLocation; dazu kommen aktuelle Lage, wir müssen 1. Fügen Sie CoreLocation Framework 2. Erstellen Sie ein Objekt des CLLocationManager CLLocationManager *locationManager = [[CLLocationManager alloc] init]; 3. [locationManager startUpdatingLocation]; CLLocation *location = [locationManager location]; CLLocationCoordinate2D coordinate = [Ort koordinieren];
  • Google Maps hat eine Funktion, bekommt der Benutzer den Standort, aber ich weiß nicht, wie um es zu bekommen
  • Siehe: stackoverflow.com/questions/16331767/... Hoffe, Es hilft
  • Ich sah, dass, aber es scheint nicht zu funktionieren für mich
  • wenn ich es benutze, hab ich den leeren Bildschirm, zeige ich die Karte auf eine benutzerdefinierte Ansicht und wollen sich Längen-und Breitengrad der aktuellen Position ?
InformationsquelleAutor Alexyuiop | 2013-06-12
Schreibe einen Kommentar