I am using Parse's PFUser to create and save a user's information when they sign up but I'm getting an error "'PFUser' does not have a member named 'subscript'" at the lines where I have to set the user's firstName and zipcode. The code ran perfectly before and I haven't been able to find anything online or in my history that would explain this error. Please help!
func signUp() {
var user = PFUser()
user.email = email.text
user["firstName"] = firstName.text
user["zipcode"] = zipcode.text
user.objectId = objectId
//etc... }
You can use the method setValue:forKey:
Example:
func signUp() {
var user = PFUser()
user.email = email.text
user.setValue(firstName.text, forKey:"firstName")
user.setValue(zipcode.text, forKey:"zipcode")
user.objectId = objectId
//etc... }
If you are using iOS 9 you must download the new parse SDK, thats why you are having that problem.
来源:https://stackoverflow.com/questions/32620466/pfuser-does-not-have-a-member-named-subscript