Facebook iOS SDK posting as a Page -


in ios app, want post on facebook page facebook page.

i retrieve page access tokens through 'me/accounts' endpoint through user. however, not sure how create fbsession using page access token in order create post request.

the page access token string, , obtained correctly asking user 'manage_pages' , 'publish_streams' permissions.

is there easy way this? have been looking @ fetchfbaccesstokendata not sure how use it.

the answer - , took me long time find - initwithsession:fbsession.activesession should initwithsession:nil, , access token should set direction in parameters nsdictionary field [parameters setobject:youraccesstoken forkey:@"access_token"]. access token in fbsession.activesession overrides access_token in parameters (which shouldn't imho), making post appear "fan" post, instead of post page.

[d addobject:yourfetchedaccesstokenstring forkey:@"access_token"]; fbrequest *request = [[fbrequest alloc] initwithsession:nil                                               graphpath:graphpath                                              parameters:d                                              httpmethod:@"post"]; 

of course there other issues, such how long access token last, requires token caching stategies: https://developers.facebook.com/docs/howtos/token-caching-ios-sdk/

found answer here: https://github.com/facebook/facebook-ios-sdk/pull/483


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -