我正在使用以下代码在解析服务器中保存 PFGeoPoint:
var coordinates = PFGeoPoint (latitude: (newCoordinate2.latitude), longitude:(newCoordinate2.longitude))
var aboutSpot = PFObject(className: "spotdetail")
aboutSpot["name"] = "name"
aboutSpot [PFGeoPoint] = coordinates
aboutSpot.saveInBackgroundWithBlock { (succes, error) -> Void in
print("separate name and geopoint have been saved")
}
我收到以下消息:
swift cannot convert value of type `(PFGeoPoint).type (aka 'PFGeoPoint.type`) to expected argument type 'String'
我可以更改什么以使 Xcode 不再认为我正在尝试保存字符串?
最佳答案
首先尝试将经度和纬度转换为 double
,然后使用 distanceInKilometersTo
或 distanceInMilesTo
。
希望这有帮助。
关于xcode - 将 PFGeoPoint 转换为字符串错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37529420/