将GeoPoint保存到DB / Heroku的问题

时间:2016-08-19 06:00:19

标签: heroku parse-server pfobject geopoints

我有这样的代码来获取Core Data中的对象并将其保存到mLab数据库,与Heroku一起使用。

// item is an NSManagedObject ....
var dataDict:[String:AnyObject]
dataDict = ["name": item.valueForKey("name") as! String,
            "address": item.valueForKey("address") as! String]

let gpsStr = item.valueForKey("gPS") as! String,
commaRange = gpsStr.rangeOfString(","),
gPS = PFGeoPoint(latitude: Double(gpsStr.substringToIndex((commaRange?.startIndex)!))!,
                 longitude: Double(gpsStr.substringFromIndex((commaRange?.endIndex)!))!)
dataDict["gPS"] = gPS

let parse_Object = PFObject(className: "TheGoodClass", dictionary: dataDict)

parse_Object.saveInBackgroundWithBlock { (succeeded: Bool, error: NSError?) in
    if (succeeded) {
        print("IT all went RIGHT")
    } else {
        print("IT all went WRONG")
    }
}

运行时,我收到此类错误消息:

.... [Error]: schema mismatch for TheGoodClass.gPS; expected String but got GeoPoint (Code: 111, Version: 1.12.0)
IT all went WRONG

我不明白为什么在这里需要String。 我想要一个GeoPoint而不是String。我需要做什么?

0 个答案:

没有答案