I try to save my data to parse.com. I have already pre-made a class in parse.com named 'SomeClass'. This has a column named 'mySpecialColumn' with a datatype of String.
This is the code I try to save data with:
var groupObject = PFObject(className: "SomeClass")
groupObject.addObject("aaa", forKey: "mySpecialColumn")
groupObject.saveEventually()
If I run this I get:
Error: invalid type for key mySpecialColumn, expected string, but got array (Code: 111, Version: 1.6.0)
This is how my core at parse.com look like:
Anyone know why I get this error? I have also tried to to it the lazy way and not pre-make the data class and just create it on the fly, but then it creates all columns as data type Array.
The addObject
method is used to append a new object in the array corresponding to the given key. Saving fails because you're trying to save an array where a string is expected.
You have to use setObject:forKey:
instead
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With