Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Romain Gaget
24,449 PointsParse - PFUser - Relating User in Parse (extra credit)
Can someone help me please, I'm trying to create some additional fields to my sign Up user but I can't find the right way! I looked at parse documentation but i quite confuse with PFUser and PFObject.... Do I need to create a new class of a subclass of PFUser and how do i Do that???
Thank
3 Answers
Camilo Castro
Courses Plus Student 2,549 PointsHere's how to create a new user with additional data
PFUser * user = [PFUser user];
user.username = @"user1";
user.password = @"12345";
user.email = @"user1@example.com";
user[@"fullName"] = @"Happy User";
user[@"birthDay"] = [NSDate date];
[user signUp];
Romain Gaget
24,449 PointsBelow my code:
PFUser *newUser = [PFUser user]; newUser.username = username; newUser.password = password; newUser.email = email; newUser[@"Town"] = town;
[newUser signUp];
Error : Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<SignupViewController 0x9b40e20> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Town.'
Camilo Castro
Courses Plus Student 2,549 Pointsthats pretty odd.
are you sure you import parse framework and everything?
Please dowload the blank starter project
https://www.parse.com/downloads/ios/parse-starter-project/latest
and try your code.
Romain Gaget
24,449 PointsI did that already, do i need to modify something in those fileS as well like the the PFuser.h?
Camilo Castro
Courses Plus Student 2,549 PointsI created a sample project
https://www.dropbox.com/s/ns54qc84fdixs4t/CreateNewUser.zip
Just add your parse keys.
:)