Facebook SDK for iOS doesn't post a photo along with the link -
i'm trying post message including link , image, on post can't see image. don't error. post published correctly, displaying both message , link, photo not show.
-(void)postonfacebook { if (fbsession.activesession.isopen) [self postonwall]; else { [fbsession openactivesessionwithpublishpermissions:[nsarray arraywithobjects:@"publish_actions", nil] defaultaudience:fbsessiondefaultaudienceeveryone allowloginui:yes completionhandler:^(fbsession *session, fbsessionstate status, nserror *error) { if (error) nslog(@"login failed"); else if (fb_issessionopenwithstate(status)) [self postonwall]; }]; }; } - (void)postonwall { fbrequestconnection *newconnection = [[fbrequestconnection alloc] init]; fbrequesthandler handler = ^(fbrequestconnection *connection, id result, nserror *error) { [self requestcompleted:connection forfbid:@"me" result:result error:error]; }; nsmutabledictionary *params = [[nsmutabledictionary alloc] initwithobjectsandkeys: @"test", @"message", @"www.google.com", @"link", [uiimage imagenamed:@"temp.png"], @"picture", @"description", @"description", nil]; fbrequest *request=[[fbrequest alloc] initwithsession:fbsession.activesession graphpath:@"me/feed" parameters:params httpmethod:@"post"]; [newconnection addrequest:request completionhandler:handler]; [requestconnection cancel]; requestconnection = newconnection; [newconnection start]; }
the picture
parameter expects valid url. see here more information.
if have picture data first have deploy , generate link image , provide same picture url
.
or, can first post image on facebook using /photos
, use in /feed
.
hope helps. luck!
Comments
Post a Comment