0

I want to add many rows at the same time to my data storage in Parse and I know that the column name and the inserting value should be typed as String but I don't get why this doesn't work . Can some one help me :)

let myClass = PFObject(className: "Testing")

for (var i = 0 ; i <= 10 ; i++){
    myClass["column \(i)"] = "\(i)"
}

myClass.saveInBackground()
2
  • I can't edit the question but the "myClass.saveInBackground()" is out of curly braces :) Commented Jan 30, 2016 at 12:31
  • I edited it out, but you can edit the question by selecting the edit button. Commented Jan 30, 2016 at 15:34

1 Answer 1

1

Try this:

let myClass = PFObject(className: "Testing")

for (var i = 0 ; i <= 10 ; i++){
    myClass["column\(i)"] = "\(i)"
}

myClass.saveInBackground()
Sign up to request clarification or add additional context in comments.

2 Comments

So, to clarify for future readers, the error was the space in the column name
in case that I had an array storing some data and I wanted to insert that into my data table and I wanted each one to be inserted at a new row then what should I do :) ? @Moonwalkr

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.