I have code like this to take an object in Core Data and save it to a mLab database, working with 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")
}
}
When running it I get this kind of error message:
.... [Error]: schema mismatch for TheGoodClass.gPS; expected String but got GeoPoint (Code: 111, Version: 1.12.0)
IT all went WRONG
I don't understand why a String is expected here. I want a GeoPoint and not a String. What do I need to do?