parse.com - How to update a field in User class using parse for ios? -



parse.com - How to update a field in User class using parse for ios? -

i developing app using parse backend. in app, have registration module. user enters email , password, , send info parse , set username temporarily temp. on next screen, user prompted select username, , shall update username in backend accordingly. here's problem: field username's value doesn't updated. these few ways have tried after looking internet.

//sharedclass singleton class, save object id of registered user attribute objectid. nsstring * objectid = sharedclass.sharedinstance->objectid; nslog(@"%@", objectid); pfobject *pointer = [pfobject objectwithoutdatawithclassname:@"user" objectid:objectid]; sharedclass.sharedinstance->user.username = self.username.text; [pointer setobject:self.username.text forkey:@"username"]; [pointer saveinbackground];

this 1 says no object found. though objectid alright. there 1 here:

pfquery *query = [pfquery querywithclassname:@"users"]; [query wherekey:@"objectid" equalto:objectid];//objectid default parse field , objectid string created [query getfirstobjectinbackgroundwithblock:^(pfobject * users, nserror *error) { if (!error) { [users setobject:self.username.text forkey:@"username"]; [users saveinbackground]; nslog(@"done"); } else { // did not find userstats current user nslog(@"error: %@", error); } }];

this 1 says no results matched query.

then have one:

pfquery *query = [pfquery querywithclassname:@"users"]; [query getobjectinbackgroundwithid:objectid block:^(pfobject *username, nserror *error) { username[@"username"] = self.username.text; [username saveinbackground]; }];

it has same error query has no matching results. how query right? can explain why these queries aren't working? how retrieve object id when user registration successful

//objectid native string , objectid parse default field sharedclass.sharedinstance->objectid = sharedclass.sharedinstance->user.objectid;

here screenshot of info on parse understand structure. http://i61.tinypic.com/21j3o8k.png

according parse documentation pfuser, , this question on parse q&a site, pfuser special type of pfobject.

rather using [pfquery querywithclassname:], need phone call [pfuser query] retrieve pfquery object can search objects in users database - example:

pfquery *query = [pfuser query]; [query wherekey:@"objectid" equalto:objectid]; [query getfirstobjectinbackgroundwithblock:....

ios parse.com

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -