Mein Ziel ist es, die Kamera den aktuellen Standort eines Benutzers zu bewegen, aber für irgendwie zeigt es die allgemeine Karte, habe ich viele Dinge ausprobiert, aber es scheint, als würde es nicht bewegen aktuellen Standort des BenutzersKann den aktuellen Standort (GPS) auf Google Maps nicht finden ios sdk
Screenshot
aktuelle Code
import UIKit
import GoogleMaps
class ParcelViewController: UIViewController, GMSMapViewDelegate {
@IBOutlet var mapView: GMSMapView!
let locationManager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
locationManager.delegate = self
locationManager.requestWhenInUseAuthorization()
mapView.delegate = self
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
// Mark: -CLLocationManagerDelegate
extension ParcelViewController: CLLocationManagerDelegate {
func locationManager(manager: CLLocationManager, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
if status == .AuthorizedWhenInUse {
locationManager.startUpdatingLocation()
mapView.myLocationEnabled = true
mapView.settings.myLocationButton = true
}
}
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let location = locations.first {
mapView.camera = GMSCameraPosition(target: location.coordinate, zoom: 15, bearing: 0, viewingAngle: 0)
locationManager.stopUpdatingLocation()
}
}
}
Sie erhalten zunächst die Erlaubnis Alarm –
Wie würde ich das tun? – airsoftFreak
ok Versuch einmal in Gerät –