Unable to get publish_action publishing permission on iOS

I spent hours on it and cannot make it work. Basically, I just want my application to have a button that I’ll β€œlike” on Facebook. I created an app on dev Facebook and its associated app page. In my code, I request these permissions:

_permissions = [NSArray arrayWithObjects:@"publish_stream", @"publish_actions", @"user_birthday", nil]; 

I can get the profile picture perfectly, but when I try "Like" with this code:

 NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: _facebook.accessToken, @"access_token", nil]; [_facebook requestWithGraphPath:@"329756493773381/og.likes" andParams:params andHttpMethod:@"POST" andDelegate:self]; 

I get this answer:

 (facebookErrDomain error 10000.)" UserInfo=0x20090590 {error={ code = 200; message = "(#200) Requires extended permission: publish_actions"; type = OAuthException; }} 

Upon entering the application, Facebook asks me for permission to view my birthday and tell me that it will send on my behalf, but does not seem to receive publish_actions permission.

Is there something I am missing that I need to do?

I see that Temple Run has a Facebook Like button and offers bonus coins for clicking it. This is what I want to achieve.

EDIT -------

I changed my rights only to @ "publish_actions", @ "user_birthday", and now the auth dialog says

"This application can send on your behalf, including objects you like and more."

which seems to be the permission of publish_actions, however I was still getting the error

message = "(# 200) Requires extended permission: publish_actions";

I changed this line:

 [_facebook requestWithGraphPath:@"329756493773381/og.likes" andParams:params andHttpMethod:@"POST" andDelegate:selrf]; 

:

 [_facebook requestWithGraphPath:@"329756493773381/og.likes" andDelegate:self]; 

and now I get the answer back, although it doesn’t post β€œhow”

This is the result:

 { data = ( ); paging = { next = "https://graph.facebook.com/329756493773381/og.likes?sdk=ios&sdk_version=2&access_token=BAAGeAp3ZBGwoBAPICjlgB5zK0YECyP8yElf8hJoMrx8Qs4vjeZAK5PlXFAVbGM1JyXHE0wZBvU0aBeCzCUTZBejQgoJ44CAIQsrG64TfrHdxjMqWD&format=json&offset=25&limit=25"; }; } 

Any idea what to try next?

EDIT 2 --------------- I am moving forward. I added a user id to a graph request like this

 NSString *graphPath = [NSString stringWithFormat:@"%@/og.likes",facebookID]; 

and used these parameters

 NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"AAAGeAp3ZBGwoBABvKjsPZAoQQNG9cDPJI2v2TI8acyyPSNtm9ZBkfydHqVZAjSKWSbLuvFwxyxSrCts7kFZCnh7Y6f5PFNlWb6smF8XF33wlRZBgfLyhT1", @"access_token", @"http://samples.ogp.me/329756493773381", @"object", nil]; 

and now I like to show on my timeline :-) I used the access token provided by the Facebook login, but it seems that the one provided by the chart object is different.

Now, the similar I see has this pattern:

Darren loves an object on MyAPP

Is it possible that he will

Darren loves MyAPP with him a link to the Facebook application page?

thanks

+6
source share
2 answers

Check if you have completed the following steps:

https://developers.facebook.com/docs/opengraph/tutorial/

"Note: A custom prompt for this permission will be displayed on the first screen of the extended Auth dialog and cannot be canceled as part of the authentication flow." - link

Try it if you already have:

Auth Dialog β†’ Configure how Facebook links to users in your application β†’ Add publishing rights.

https://developers.facebook.com/docs/opengraph/authentication/

"To enable the new Auth dialog, go to the application panel and enable the Enhanced Auth Dialog setting in the Advanced section of your application." -link

Hope this helps!

+5
source

This seems to be the same problem as I have in this SO question: Facebook iOS SDK 3.0, implement as an action at the url?

But if you want to like you on the facebook page in the application, there is no way in Objective C. to do this. Only with the help javascript Like button, you can create here: https://developers.facebook.com/docs/reference/plugins/like/

The way Temple Run does this displays the β€œLike” button in the web view, so they, like the button actually on their server, are probably ugly to hack, but will work in order to please the page.

0
source

Source: https://habr.com/ru/post/919627/


All Articles