0

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
  }
}
2
  • Where's your boolean array? Example code doesn't have any arrays. Commented Dec 10, 2015 at 12:34
  • what is the error? please provide more info. Commented Dec 10, 2015 at 12:38

1 Answer 1

1

Try this.

let myBooleanArray = [false,true,false,true,true,false]
let myObject = PFObject(className: "MyObject")
myObject["booleanArrayColumn"] = myBooleanArray
myObject.saveEventually()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.