Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何使用谷歌API锁定用户的当前位置?_Ios_Swift_Google Maps - Fatal编程技术网

Ios 如何使用谷歌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() {

我添加了GoogleMaps API,它显示了硬编码的位置,代码如下:

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)