While fetching object using query only certain columns are fetched and the rest is nil. I have also tried fetchIfNeededInBackgroundWithBlock
but with no luck.
Query:
let query = PFQuery(className:"Order")
query.whereKey("buyerUser", equalTo: PFUser.currentUser()!)
query.findObjectsInBackgroundWithBlock { (orders: [PFObject]?, error: NSError?) -> Void in
if(error == nil){
print(orders?.first)
}
}
Output:
Optional(<Order: 0x7ff778011940, objectId: KytyBZD9zV, localId: (null)> {
buyerUser = "<PFUser: 0x7ff77353e520, objectId: xxxxx, localId: (null)>";
charged = 1;
fulfilled = 0;
item = "<Item: 0x7ff778011dd0, objectId: GN277W4mO0, localId: (null)>";
shippingUser = "<PFUser: 0x7ff778012270, objectId: xxxx, localId: (null)>";
stripePaymentId = "xxxxxx";})
Order
class in Parse Data Browser
If I try to access the transactionId
with following code:
let order = orders?.first
print(order.objectForKey("transactionId"))
The result is always nil
.
Please help.
Update
Attached is the Order
class data in Parse. As all the rows have data and the object I have used have returned some data in other columns (buyerUser, charged) there is data in transactionId
column of the object.
print(order["transactionId"])
? I believe the problem is that you are dealing with aPFObject
class object as a dictionary.