The class parse column value is always nil

When retrieving an object using a query, only certain columns are retrieved, and the rest are zero. I also tried fetchIfNeededInBackgroundWithBlock , but 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

Order class

If I try to access transactionId with the following code:

 let order = orders?.first print(order.objectForKey("transactionId")) 

The result is always nil .

Please, help.

Update

Attached data class Order in Parse. Since all rows have data, and the object that I used returned some data in other columns (buyerUser, charge), there is data in the transactionId column of the object.

Sort Order Class Data

+7
ios swift
source share
1 answer

I don't see "transactionId" in the console message you sent - if the key you are looking for is missing, it will return nil

charged = 1; satisfied = 0; item = "; shippingUser =" "; stripePaymentId =" XXXXXX ";})

Update: Server information and a message in the console do not match eq: Order: 0x7fb253fedc80, objectId: WrgiDFxZW6, which cannot be located in the server data associated with the question.

This can happen if you refer to a different table in the Parse SDK than the one you used on the Internet (screenshot) - make sure that you assign the same table in the code and on the Internet.

+4
source share

All Articles