0
如何將NSString轉換爲CLLocationCoordinate2DMake。我想在地圖上做一個標記。這是我所做的,但我得到「NSString不能轉換爲CLLocationDegrees」錯誤。使用Swift將NSString轉換爲CLLocationCoordinate2DMake
for openComplain in openComplains {
var lat = openComplain["lat"] as NSString
var long = openComplain["lng"] as NSString
NSLog("Lat is %@",lat)
NSLog("long is %@",long)
var complainLoc = CLLocationCoordinate2DMake(lat, long)
var marker : GMSMarker = GMSMarker(position: complainLoc)
marker.title = "Complain 1"
marker.map = self.mapView
}
我已經試過
var lat = (openComplain["lat"] as NSString).doubleValue
var long = (openComplain["lng"] as NSString).doubleValue
但在這種情況下,我得到空值。請幫忙。