Facebook iOS SDK errors – Posting Open Graph Actions -
i'm attempting post open graph object action (using stories) facebook, receive error doesn't give me details. summed code i'm using single method guys:
- (void)publishtograph { nsmutabledictionary<fbopengraphobject> *object = [fbgraphobject opengraphobjectforpost]; object.provisionedforpost = yes; object[@"title"] = @"example title"; object[@"type"] = @"rs-coupcash"; object[@"description"] = @"example description"; object[@"url"] = @"http://exampleurl.com/idk"; object[@"image"] = @[@{@"url": @"http://exampleurl.com/example_url.png", @"user_generated" : @"true" }]; [fbsession openactivesessionwithpublishpermissions:@[@"email", @"public_profile", @"publish_actions"] defaultaudience:fbsessiondefaultaudiencefriends allowloginui:yes completionhandler:^(fbsession *session, fbsessionstate state, nserror *error) { if (!error && state == fbsessionstateopen) { [fbrequestconnection startforpostopengraphobject:object completionhandler:^(fbrequestconnection *connection, id result, nserror *error) { if(!error) { nsstring *objectid = [result objectforkey:@"id"]; nslog(@"object id: %@", objectid); id<fbopengraphaction> actionobject = (id<fbopengraphaction>)[fbgraphobject graphobject]; [actionobject setobject:objectid forkey:@"coupon"]; [fbrequestconnection startforpostwithgraphpath:@"/me/rs-coupcash:favorite" graphobject:actionobject completionhandler:^(fbrequestconnection *connection, id result, nserror *error) { [[fbsession activesession] close]; if(!error) { nslog(@"og story posted, story id: %@", [result objectforkey:@"id"]); } else { nslog(@"error: %@", error); } }]; } else { nslog(@"error: %@", error); } }]; } else { nslog(@"error: %@", error); } }]; }
the error get:
error domain=com.facebook.sdk code=5 "the operation couldn’t completed. (com.facebook.sdk error 5.)" userinfo=0x114544670 {com.facebook.sdk:httpstatuscode=500, com.facebook.sdk:errorsessionkey=, expirationdate: 2014-08-26 05:18:45 +0000, refreshdate: 2014-06-27 16:56:32 +0000, attemptedrefreshdate: 0001-12-30 00:00:00 +0000, **permissions**:( installed, "public_profile", email, "publish_actions" )>, com.facebook.sdk:parsedjsonresponsekey={ body = { error = { code = 1; message = "an unknown error has occurred."; type = oauthexception; }; }; code = 500; }}
i using wrong type open graph object; using namespace "type" value, should "rs-coupcash:coupon" in case.
Comments
Post a Comment