Question

I am using facebook sdk and need to share details to facebook timeline. I am using the following api call.

  [FBRequestConnection startWithGraphPath:@"/feed"
                             parameters:dictionary
                             HTTPMethod:@"POST"
                      completionHandler:^(FBRequestConnection *connection,
                                          id result,
                                          NSError *error)
 {
     if (!error) {
          [VBUtility showAlertWithTitle:@"Facebook" message:@"Deal details posted successfully"];
     }
 }];

The story is published on facebook, not at user's timeline but user's newsfeed (The document tells this method does - posts and links published by this person or others on their profile.). I have also tried with /home method call. While I tried with the built in facebook share,

SLComposeViewController *fbPost = [SLComposeViewController
                                   composeViewControllerForServiceType:SLServiceTypeFacebook];

it is perfectly published to user's timeline as well as in news feed. I have configured the app in the developer.facebook.com. Do I need to mention any permissions here. Does any one can help me finding the mistake? Permission Request,

 NSArray *permissions = [[NSArray alloc]initWithObjects:@"publish_actions",@"user_birthday",@"publish_stream",@"user_about_me",@"email",@"basic_info",nil];

The parameters passed are,

NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                                   app_id, @"app_id",
                                                   name,@"name",
                                                   caption, @"caption",
                                                   description,@"description",
                                                   link, @"link",
                                                   picture, @"picture",
                                                   @"1",@"fb:explicitly_shared",
                                                   nil];
Était-ce utile?

La solution

Try this,

 [FBRequestConnection startWithGraphPath:@"me/feed"
                             parameters:dictionary
                             HTTPMethod:@"POST"
                      completionHandler:^(FBRequestConnection *connection,
                                          id result,
                                          NSError *error)
 {
     if (!error) {
          [VBUtility showAlertWithTitle:@"Facebook" message:@"Deal details posted successfully"];
     }
 }];

I changed little bit from your code. Change your path as @"me/feed". I hope, this may help you.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top