P
P
Pavel Makukha2015-05-18 08:21:26
Facebook
Pavel Makukha, 2015-05-18 08:21:26

How to post to Facebook wall from app with facebook-ios-sdk 4.1.0?

Facebook-iOS-SDK 4.1.0 can't post a link to my FB wall.
During authorization I request the rights to @"publish_actions". I log in as one of the users in the application's Roles list on Facebook.
The code is like this:

if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"publish_actions"]) {
        [[[FBSDKGraphRequest alloc] initWithGraphPath:@"/me/feed"
                                           parameters: params
                                           HTTPMethod:@"POST"]
        startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
            if (!error) {
                success( result );
            } else {
                failed( error.description );
            }
        }];
    }

The request goes away, but there is no answer. Nothing happens. Generally. It looks like it's flying into space.
Did I understand correctly that now Facebook will check applications that use sdk and post information on the wall?
To do this, you need to send them an application.
At the moment, I can't do that because Facebook says there are no active requests with publish_actions in the last month. I don't understand why this is happening. After all, the code above should send such requests.
0a1c58a3ba1645f193296c0761386fb4.png
picture from app settings in FB.

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
P
Pavel Makukha, 2015-05-18
@marsohod

Found a problem.
i was trying to send a post to the wall in another thread via dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{}); The Facebook docs say the following:

FBSDKRequestConnection uses NSURLConnection which requires an active RunLoop. If you're using it outside of the main thread you have to manage this yourself.
alternatively, you can set the delegateQueue property on the FBSDKRequestConnection.

Therefore, I had to replace dispatch_async with NSOperationQueue. And add it to FBSDKGraphRequestConnection via setDelegateQueue

S
s0L, 2015-05-18
@s0L

How does it leave you if you cannot get publish_actions? Most likely at you the request simply is not executed under a condition. As for the post on the wall, it is not necessary to do this through API requests, it can be done through dialogs or the tool built into iOS, for this you do not need to receive publish_actions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question