xcode - 将 PFGeoPoint 转换为字符串错误

标签 xcode swift parse-platform

我正在使用以下代码在解析服务器中保存 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,然后使用 distanceInKilometersTodistanceInMilesTo

希望这有帮助。

关于xcode - 将 PFGeoPoint 转换为字符串错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37529420/

相关文章:

ios - Swift 2 调用中的额外参数 ' error'

ios - 如何将图像设置为具有背景颜色的图像查看中心迅速

ios - 如何使用 Swift 从本地镜像获取 Exif 数据?

javascript - 在 Parse.com 上注册 JS jQuery

swift - 当两个屏幕都是 Swift 中 NavigationController 中的元素时,如何在两个屏幕之间传递数据?

iphone - 在 iPhone 5 和 iPhone 4 的界面生成器中居中对齐

ios - 来自 UICollectionReusableView(Header) 自定义按钮 Swift 的 PerformSegue

ios - 当协议(protocol)的可空性发生变化时支持多个 iOS SDK 版本

xcode - 解析 Facebook 登录失败,错误代码为 251

java - 限制按钮只能点击一次