objective c - Error when calling PFCloud function from iOS app -


i using cloud code in order add 2 users chatroom, app crashes when call cloud code function.

in ios viewcontroller, user clicks button calls following method:

-(void)createchatroom {     pfquery *queryforchatroom = [pfquery querywithclassname:@"chatroom"];     [queryforchatroom wherekey:@"user1" equalto:[pfuser currentuser]];     [queryforchatroom wherekey:@"user2" equalto:self.giveitem.itemgiver];      pfquery *queryforchatroominverse = [pfquery querywithclassname:@"chatroom"];     [queryforchatroominverse wherekey:@"user1" equalto:self.giveitem.itemgiver];     [queryforchatroominverse wherekey:@"user2" equalto:[pfuser currentuser]];      pfquery *combinedchatroomquery = [pfquery orquerywithsubqueries:@[queryforchatroom, queryforchatroominverse]];      [combinedchatroomquery findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) {         if ([objects count] == 0){             [pfcloud callfunctioninbackground:@"adduserstochatroom" withparameters:@{@"user1" : [pfuser currentuser]} block:^(id object, nserror *error) {                 [self performseguewithidentifier:@"itemtochatsegue" sender:nil];             }];          };     }];  } 

and here javascript function stored in parse cloud.

parse.cloud.define("adduserstochatroom", function(request, response){   response.success("jared method call works, no implement it");   console.log("this being logged console");   var user = response.body.user1;   console.log(user); }); 

when press button call method, app crashes , output of errors looks this:

[pfinternalutils encodeobject:allowunsaved:allowobjects:] [pfinternalutils encodeobject:allowunsaved:allowobjects:] [pfcloud callfunctionasync:withparameters:] [pfcloud callfunctioninbackground:withparameters:block:] __36-[myviewcontroller createchatroom]_block_invoke __40-[pftask thencallbackonmainthreadasync:]_block_invoke_2 

how can move forward error?

once error resolved, able read cloud code output? when use curl hit app's cloud code (https://parse.com/docs/cloud_code_guide), given "hello world!" output, in case i'm calling js function objective-c code , i'm not sure can monitor console output. (ultimately, replace console output in js function actual functionality looking for.)

how can learn make sense of error-message output?

pfuser currentuser answers object, must pass dictionary of serializable types -- user id or username -- callfunctioninbackground:withparameters:. also, cloud function should invoke either response.success() or response.error().


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -