Monday, 15 September 2014

ios - (parse) getting error when updating pfobject -



ios - (parse) getting error when updating pfobject -

however simple may be, still struggling update pfobject info

-(ibaction)postmessagetapped:(id)sender{ [self hidetextfield:_messagetextfield]; nsmutablearray *mynewmessagearray=[[nsmutablearray alloc]init]; [mynewmessagearray insertobject:_messagetextfield.text atindex:0]; [mynewmessagearray insertobject:[pfuser currentuser] atindex:1]; pfquery *query = [pfquery querywithclassname:classname]; [query getobjectinbackgroundwithid:currentid block:^(pfobject *object, nserror *error) { object[messagingarray] = mynewmessagearray; [object saveinbackground]; }]; }

the intent message string text field , current user name, , set array updates array exists on parse database. however,

cannot comparing query type: (null)

comes when user taps button posts message.

does have possible solution?

edit:

pfquery *query = [pfquery querywithclassname:classname]; [query wherekey:@"location" neargeopoint:locationofselectedpin]; [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) { if (!objects) { nslog(@"the getfirstobject request failed."); } else { for(pfobject *objecttest in objects){ nslog(@"successfully retrieved object."); objecttest[@"messagingarray"]=mynewmessagearray; [objecttest saveinbackground]; } } }];

i have tried using update data, 'successfully retrieved object' gets printed 3 times, followed 3 lines of 'error, object not found update'.

check setting objectid - error means cannot object because passing nil value database lookup.

here's bit of code handle exception:

if (!currentid) { nslog(@"your currentid object nil! check assignment."); } else { pfquery *query = [pfquery querywithclassname:classname]; [query getobjectinbackgroundwithid:currentid block:^(pfobject *object, nserror *error) { object[messagingarray] = mynewmessagearray; [object saveinbackground]; }]; }

ios objective-c parse.com

No comments:

Post a Comment