Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

PFGeopoint, PFFile not converted #16

Closed
@Eke

Description

@Eke

When Update,Create or other events are received PFObject is not generated correctly.

Instead of

<PFGeoPoint: 0x1360a4490, latitude: 42.722461, longitude: 45.792475>

I got this assigned to my PFUser subclass location property:

{
    "__type" = GeoPoint;
    latitude = "42.72246132158908";
    longitude = "45.79247540719969";
}

Same happens with PFUser avatar property and all PFObjects, PFPointers and etc

In ClientPrivate.swift i added

if value is Dictionary<String,AnyObject>{
   let objectType = value.valueForKeyPath("__type") as? String;
   let lat = value.valueForKeyPath("latitude") as? Double;
   let lng = value.valueForKeyPath("longitude") as? Double;
   if(key == "location" && objectType == "GeoPoint"){
       let geoPoint:PFGeoPoint = PFGeoPoint.init(latitude: lat!, longitude: lng!)
           parseObject[key] = geoPoint;
       }
   }
}

After this change GeoPoint is assigned to PFUser subclass as needed, but i am not very familiar with swift and don't think my solution is good, any ideas @nlutsenko @richardjrossiii ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions