Reputation: 225
I have a boolean array which contains 10 boolean values. I would like to save this array to Parse.com
There is an example on Parse.com, but when I try to save arrays it doesn't really seem to work:
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
}
}
Upvotes: 0
Views: 148
Reputation: 4391
Try this.
let myBooleanArray = [false,true,false,true,true,false]
let myObject = PFObject(className: "MyObject")
myObject["booleanArrayColumn"] = myBooleanArray
myObject.saveEventually()
Upvotes: 1