I have following 2 parse classes Items and categories. The Items class have a column named category which is a pointer and points to a specific id in the categories in the class. However when i want to retrieve the data from a category through this pointer it only return following:
<Categories: 0x7ffddac633b0, objectId: dHbrk97s97, localId: (null)> {
}
which is strange since categories class contain a name, createdAt and updatedAt? why are these not shown in this object?
Full code
func retrieveData() {
//Query Item Information
var query = PFQuery(className:"Items")
query.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]?, error: NSError?) -> Void in
if error == nil {
// The find succeeded.
// Do something with the found objects
if let objects = objects as? [PFObject] {
self.collectionView.reloadData()
for object in objects {
var itemId = object.objectId!
var description = object["description"]! as! NSString
var createdAt = object.createdAt!
var title = object["title"]! as! NSString
var price = object["price"]! as! Int
var category = object["category"] as! PFObject
println(category)
//Query image
var query = PFQuery(className:"Images")
query.whereKey("imageId", equalTo:itemId)
query.whereKey("primaryImage", equalTo:true)
query.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]?, error: NSError?) -> Void in
if error == nil {
// The find succeeded.
// Do something with the found objects
if let images = objects as? [PFObject] {
for image in images {
//var primaryImage = image[]
}
}
} else {
// Log details of the failure
println("Error: \(error!) \(error!.userInfo!)")
}
}
}
}
} else {
// Log details of the failure
println("Error: \(error!) \(error!.userInfo!)")
}
}
}