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.
I can not see "transactionId" in the console message you posted - if key you are looking for is not present it will return nil
charged = 1; fulfilled = 0; item = ""; shippingUser = ""; stripePaymentId = "xxxxxx";})
Update: Server information and message in the console don'e match eq: Order: 0x7fb253fedc80, objectId: WrgiDFxZW6 which can not be located in the server data attached with question.
It can happen if your are referring different table in Parse SDK than the one you used in web(screen shot) - make sure you are refereeing same table in code and web.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With