Ios 如何使用谷歌API锁定用户的当前位置?
我添加了GoogleMaps API,它显示了硬编码的位置,代码如下:Ios 如何使用谷歌API锁定用户的当前位置?,ios,swift,google-maps,Ios,Swift,Google Maps,我添加了GoogleMaps API,它显示了硬编码的位置,代码如下: import UIKit import GoogleMaps class OurViewController: UIViewController, CLLocationManagerDelegate{ // Other variables var locationManager = CLLocationManager() override func viewDidLoad() {
import UIKit
import GoogleMaps
class OurViewController: UIViewController, CLLocationManagerDelegate{
// Other variables
var locationManager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
locationManager.delegate = self
locationManager.requestWhenInUseAuthorization()
//google map
let camera = GMSCameraPosition.cameraWithLatitude(13.034211,
longitude: 77.5670453, zoom: 16)
let mapView = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
mapView.myLocationEnabled = true
self.view = mapView
let marker = GMSMarker()
marker.position = CLLocationCoordinate2DMake(13.034211, 77.5670453)
marker.title = "globals inc"
marker.snippet = "bangalore"
marker.map = mapView
}
}
有人能帮我指出如何获取用户位置吗?请通过-
及
希望这有帮助。它给出错误exc\U bad\U指令(代码=exc\U 1386\U invop,子代码=0x0)