简体   繁体   English

在后台有一个对象作为变量,如何更新值(parse.com)

[英]Have a object in background as a variable, how to update values (parse.com)

So var touser:PFObject is in the background along with its values, how do i update the value of a array of touser? 所以var touser:PFObject及其值在后台,如何更新touser数组的值?

Ex. 例如 touser.objectforkey("names") is an array of names that had been queried when the user entered the ViewController , how do I update with the current names in that array (others may have added their name to the array and a button shows the values of the array.). touser.objectforkey("names")是用户输入ViewController时已查询的名称数组,如何使用该数组中的当前名称进行更新(其他人可能已将其名称添加到该数组中,并且按钮显示数组的值)。

I hope I'm understanding your question correctly. 希望我能正确理解您的问题。

You want to update your names in the PFObject? 您要更新PFObject中的名称吗?

var touser: PFObject
touser.objectForKey("names") as [String] //Assuming 'names' is [String]
let newNames = ["A", "B"]
touser.setObject(newNames, forKey: "names")
touser.saveEventually()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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