Множественный маркер не отображается на карте Google с помощью swift 4.1. Я подключаю JSON, и результат отображается на консоли, но как я могу подключиться к широте и долготе с помощью карт Google.
let jsonUrl = URL(string: "http://assetlinkasia.no-ip.biz:8001/hf_tracker/api/userdevices.php?accesskey=12345&user_id=1")
if let url = jsonUrl {
let data = NSData(contentsOf: url)
if let data = data {
do{
let jsonObject = try JSONSerialization.jsonObject(with: data as Data, options: .allowFragments)
if let object = jsonObject as? [NSString: AnyObject]{
if let allDevices = object["data"] as? [[NSString: AnyObject]]{
print("Successfull")
print(allDevices)
}
}
}catch{
print("Error Eccurred")
}
}
}
и это мой код карты Google здесь:
let getLongijson = Double("67.0011")
let getlatijson = Double("24.8607")
let camera = GMSCameraPosition.camera(withLatitude: getlatijson!, longitude: getLongijson!, zoom: 13.0)
let mapView = GMSMapView.map(withFrame: view.bounds, camera: camera)
self.view = mapView
// meanView.addSubview(mapView)
let marker = GMSMarker()
marker.position = CLLocationCoordinate2D(latitude: getlatijson!, longitude: getLongijson!)
marker.infoWindowAnchor = CGPoint(x:0.10, y:0.10)
marker.title = HeadingName
marker.snippet = Countory
marker.icon = UIImage(named: "markers")
marker.map = mapView
//User Location
locationManager.delegate = self
locationManager.requestWhenInUseAuthorization()
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.startUpdatingLocation()
// self.menuFunction()
mapView.delegate = self