简体   繁体   中英

How to add multiple data in Parse in the same row at the same time

I'm using Swift code, and this code is able to store the data in the Parse, but it doesn't place it in the same row, if you could please give me some feedback on this, as I'm a self thought and beginner of coding. Thanks.

let newTransObject:PFObject = PFObject(className: "Transaction")
let pickUpTimeObject:PFObject = PFObject(className: "Transaction")
let cityObject:PFObject = PFObject(className: "Transaction")

// Set the Text Key to text of the messageTextField

newTransObject["pickup_location"] = self.myAddress.text
pickUpTimeObject["pickup_time"] = self.myTime.text
cityObject["pickup_city"] = myPlacement.locality

//save the PFObject

newTransObject.saveInBackground()
pickUpTimeObject.saveInBackground()
cityObject.saveInBackground()


self.myAddress.text = "\(myPlacement.locality!) \(myPlacement.administrativeArea!) \(myPlacement.postalCode!) \(myPlacement.ISOcountryCode!)"
self.myAddress.backgroundColor = UIColor.whiteColor()



[enter image description here][1]print("\(myPlacement.locality!) \(myPlacement.administrativeArea!) \(myPlacement.postalCode!) \(myPlacement.ISOcountryCode!)")

You need to create one PFObject and set the variable of just that. I didn't import Parse so I hope there are no errors.

let newTransObject = PFObject(classname: "Transaction")

newTransObject["pickup_location"] = self.myAddress.text
newTransObject["pickup_time"] = self.myTime.text
newTransObject["pickup_city"] = myPlacement.locality

newTransObject.saveInBackground()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM