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

时间:2015-10-31 00:09:19

标签: ios iphone swift mapkit

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!)")

1 个答案:

答案 0 :(得分:0)

您需要创建一个PFObject并设置该变量。我没有导入Parse所以我希望没有错误。

let newTransObject = PFObject(classname: "Transaction")

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

newTransObject.saveInBackground()