gran33
gran33

Reputation: 12971

Post text status/Post simple text on wall with Facebook SDK on iOS

I m using FacebookSDK for iOS v3.12.0.

I try to post simple text on user's wall:

if ([FBDialogs canPresentShareDialogWithParams:params]) {

        [FBDialogs presentShareDialogWithLink:nil
                                         name:@"name"
                                      caption:@"caption"
                                  description:@"description"
                                      picture:nil
                                  clientState:nil
                                      handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
                                          if(error) {

                                          } else {

                                          }
                                      }];
    } else {

        NSMutableDictionary *paramsDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                           @"name", @"name",
                                           @"caption", @"caption",
                                           @"description", @"description",
                                           nil];

        [FBWebDialogs presentFeedDialogModallyWithSession:nil
                                               parameters:paramsDict
                                                  handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
                                                      if (error) {
                                                          
                                                      } else {
                                                          if (result == FBWebDialogResultDialogNotCompleted) {
                                                              NSLog(@"User cancelled.");
                                                          }
                                                      }
                                                  }];
    }

Because I add nil link parameter, Facebook framework does nothing.

How can I post simple text on user's wall?

And I've seen the documentations already (seen this)

Upvotes: 1

Views: 707

Answers (1)

Fosco
Fosco

Reputation: 38526

You can't pre-fill the details, so if you're not sharing a link or a picture, it looks like you can only call it like this:

[FBDialogs presentShareDialogWithLink:nil
                              handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
     if(error) {
         NSLog(@"Error: %@", error.description);
     } else {
         NSLog(@"Success!");
     }
}];

They'll get a dialog where they can post a status update.

Upvotes: 1

Related Questions