我有一个包含10个布尔值的布尔数组。我想将此数组保存到Parse.com

Parse.com上有一个示例,但是当我尝试保存数组时,它似乎并没有真正起作用:

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
  }
}

最佳答案

尝试这个。

let myBooleanArray = [false,true,false,true,true,false]
let myObject = PFObject(className: "MyObject")
myObject["booleanArrayColumn"] = myBooleanArray
myObject.saveEventually()

关于arrays - 将数组保存到Parse.com,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34200754/

10-09 09:07