Hi,
I’m using custom subclass “Photo” in my app successfully in persistanceService requests, but when I do GeoService request, I’m getting geoPoints with “BackendlessEntity” instead of “Photo”. Why? How can I make it work?
Thank you.
Hi,
I’m using custom subclass “Photo” in my app successfully in persistanceService requests, but when I do GeoService request, I’m getting geoPoints with “BackendlessEntity” instead of “Photo”. Why? How can I make it work?
Thank you.
You should use class casting, for example:
func getGeoPointAsync() {
let geoQuery = BackendlessGeoQuery()
self.backendless.geoService.getPoints(
geoQuery,
response: { ( bc : BackendlessCollection!) -> () in
let data = bc.getCurrentPage() as! [GeoPoint]
print("GeoPoint collection have been retrieved: \(data)")
let geoPoint = data[0]
let photo = geoPoint.metadata["photo"] as! Photo
},
error: { ( fault : Fault!) -> () in
print("Server reported an error: \(fault)")
}
)
}
That’s what I do and it fails.
Please provide your Photo class (and all its embedded classes if they are) as text and your appId here or to support@backendless.com - we will try to reproduce this problem.
You were right and I was wrong:)
I’m really getting a Photo entity, but it’s embedded in an array, so one has to unwrap the array first.