I
I
IbrahimKZ2014-05-22 09:02:58
Facebook
IbrahimKZ, 2014-05-22 09:02:58

How to send a text/link/picture to a friend's (facebook) wall through your app in iOS?

In general, such a problem. Through my iOS application, I want to send data (text, picture) to a friend's wall via the Facebook SDK. It is easy to place on your wall, but it does not work on a friend's wall.
Rummaged everything on the Internet (stackoverflow, etc.). Didn't find a working example. Although they write that it is possible. As I understand it, it is no longer possible to do this through the Graph API, but it also does not work through FBWebDialogs. Climbed all https://developers.facebook.com/docs/ios. There is no necessary example and even a mention that this can be done.
Does anyone know if it is possible to do this now or not at all? Better yet, if you throw off a link to a working example. It's the worker. It doesn't matter which way, as long as it works. Because everything I found doesn't work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
corristo, 2014-05-29
@corristo

I do it through FBWebDialogs, code from a real application:

- (void)postLink:(NSString *)link withDescription:(NSString *)description toFriendsWall:(id <FBGraphUser>)friendUser
{
    if (!self.loggedIn) {
        return;
    }

    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];

    if (link != nil) {
        parameters[@"link"] = link;
    }

    if (description != nil) {
        parameters[@"description"] = description;
    }

    parameters[@"to"] = friendUser.id;

    [FBWebDialogs presentFeedDialogModallyWithSession:self.session
                                           parameters:parameters
                                              handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
                                                  if (error != nil) {
                                                      // call error callback
                                                  }
                                                  else {
                                                      // call success callback with resultURL
                                                  }
                                              }];
}

the code from the real application is slightly simplified, since in the original it was all wrapped in ReactiveCocoa, so there are no callback blocks in the method signature.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question