以编程方式创建一行Parse Swift

时间:2015-12-28 23:54:22

标签: swift parse-platform

是否可以在类中创建一行,并且根据某些变量,我在类中创建的字段是否设置为? (基本上使用swift以编程方式创建一行)

1 个答案:

答案 0 :(得分:0)

自己解决了,如果其他人想知道这就是代码:

var gameScore = PFObject(className:"GameScore")
gameScore["score"] = 1337
gameScore["playerName"] = "Sean Plott"
gameScore["cheatMode"] = false
gameScore.saveInBackgroundWithBlock {
  (success: Bool, error: NSError?) -> Void in
  if (success) {
    // The object has been saved.
  } else {
    // There was a problem, check error.description
  }
}

来自https://www.parse.com/docs/ios/guide#objects-saving/iOS

的示例