parse.com - Can not retrieve data from local database after saving it from Parse in ios -


i have logged in here code , after have saved data in local db using pinning .

[pfuser loginwithusernameinbackground:name password:pass                                 block:^(pfuser *user, nserror *error) {                                     if (user) {                                         // stuff after successful login.                                          [user pininbackground];//save in local db                                         nslog(@"user logged in");                                          //fetching profile image parse                                         pffile *userimagefile = user[@"profilepic"];                                         [userimagefile getdatainbackgroundwithblock:^(nsdata *imagedata, nserror *error) {                                             if (!error) {                                                 uiimage *proimage = [uiimage imagewithdata:imagedata];                                                 self.profilepic.image=proimage;                                             }                                         }];                                         //getting data parse                                         [_labelname settext:user.username];                                         [_labelgender settext:user[@"gender"]];                                         [_labelage settext:user[@"age"]];                                         [_labellocation settext:user[@"location"]];                                          [_labelprefgender settext:user[@"prefgender"]];                                         [_labelprefage1 settext:user[@"prefage1"]];                                         [_labelprefage2 settext:user[@"prefage2"]];                                         [_labelpreflocation settext:user[@"preflocation"]];                                          } else {                                         nslog(@" login failed. check error see why.");                                     }                           [user saveeventually];                                     [self getdatafromlocal];                                 }]; 

and after in getdatafromlocal tried fetch datas local database. can not know next? me new ios , parse.

-(void)getdatafromlocal{  pfquery *query = [pfquery querywithclassname:@"user"]; [query fromlocaldatastore]; [query wherekey:@"username" equalto:@"ira"];  [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) {     if (!error) {         nslog(@"%@", objects);     }else{         nslog(@"erro: %@", error.localizeddescription);     } }];  [[query findobjectsinbackground] continuewithblock:^id(bftask *task) {     // update ui         if (task.error) {         // went wrong;         return task;     }         else{     nslog(@"task is: %@",task.result);     // task.result game score   //  [_labelname settext:task.result];              return task;         } }]; 

} me please.upvote every helpful suggestions .


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -