facebook ios sdk - How to post comment using iOS sdk -


i need comment graph object using ios facebook sdk , can't this. comments working using social plugin, don't want use uiwebview. how can make works?

-(void)postaction {     if ([textfield.text isequaltostring:@""]) return;     if ([[fbsession activesession] isopen])     {         if ([fbsession.activesession.permissions indexofobject:@"publish_stream"] == nsnotfound)         {             [[fbsession activesession] requestnewpublishpermissions:@[@"publish_stream"] defaultaudience:fbsessiondefaultaudiencefriends completionhandler:^(fbsession *session, nserror *error) {                 [self getfbobjectgraphid];             }];         } else {             [self getfbobjectgraphid];         }     } else {         [fbsession openactivesessionwithpublishpermissions:@[@"publish_stream"] defaultaudience:fbsessiondefaultaudiencefriends allowloginui:yes completionhandler:^(fbsession *session, fbsessionstate status, nserror *error) {             [self getfbobjectgraphid];         }];     } }  -(void)getfbobjectgraphid {     nsstring *debateurl = @"open_graph_object_url";     nsstring *query =     @"select comments_fbid link_stat url = \"%@\"";     query = [nsstring stringwithformat:query, debateurl];     // set query parameter     nsdictionary *queryparam =     [nsdictionary dictionarywithobjectsandkeys:query, @"q", nil];     // make api request uses fql     [fbrequestconnection startwithgraphpath:@"/fql"                                  parameters:queryparam                                  httpmethod:@"get"                           completionhandler:^(fbrequestconnection *connection,                                               id result,                                               nserror *error) {                               if (error) {                                   nslog(@"error: %@", [error localizeddescription]);                               } else {                                   nslog(@"result: %@", result);                                   nsnumber *stringid = [[[result objectforkey:@"data"] objectatindex:0] objectforkey:@"comments_fbid"];                                   if (stringid)                                       [self postcommentwithopengraphid:[stringid stringvalue]];                               }                           }]; }  -(void)postcommentwithopengraphid:(nsstring*)ogid {     nsmutabledictionary *params =         [nsmutabledictionary dictionarywithobjectsandkeys:             textfield.text, @"message",             [fbsession activesession].accesstokendata.accesstoken, @"access_token",          nil];     [fbrequestconnection startwithgraphpath:[nsstring stringwithformat:@"%@/comments",ogid]                                  parameters:params httpmethod:@"post"         completionhandler:^(fbrequestconnection *connection, id result, nserror *error) {             if (error)             {                 nslog(@"error: %@", error.localizeddescription);             }             else             {                 nslog(@"result: %@",result);             }     }];  } 

it how looks in code. i've updated code actual. open graph object id fql first , make comment action. if change post got comments id ok. if post comment got error:

printing description of error: error domain=com.facebook.sdk code=5 "the operation couldn’t completed. (com.facebook.sdk error 5.)" userinfo=0x1d16a590 {com.facebook.sdk:httpstatuscode=500, com.facebook.sdk:parsedjsonresponsekey={     body =     {         error =         {             code = 1;             message = "an unknown error has occurred.";             type = oauthexception;         };     };     code = 500; }   permissions:(     "video_upload",     "share_item",     "publish_stream",     installed,     "status_update",     email,     "create_note",     "photo_upload",     "publish_actions" ) 


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -