如何使用facebook sdk在朋友的墙上发帖?

时间:2014-04-03 05:19:56

标签: ios iphone facebook ios7 objective-c-blocks

我使用facebook SDK 3.13使用fbwebdialogs在用户的朋友墙上发布。当我为这个对话框设置params时,它不会在对话框中显示它们。

    NSMutableDictionary *params=[NSMutableDictionary new];
    FBSession *ses=[FBSession activeSession];
    [params setValue:@"hello" forKey:@"caption"];
    [params setValue:@"hello" forKey:@"decription"];
    [params setValue:@"whats" forKey:@"name"];
    [params setValue:@"http://i.imgur.com/g3Qc1HN.png" forKey:@"picture"];
    [params setValue:@"http://www.dsvv.org" forKey:@"link"];

    [FBWebDialogs presentFeedDialogModallyWithSession:ses parameters:params handler:^(FBWebDialogResult result,NSURL *url,NSError *error){

        if (error) {

        }

    }];

}

它不识别这些链接并产生错误。如果有人发布在用户的朋友墙上,请通知我。

1 个答案:

答案 0 :(得分:1)

str_link = @"www.google.com";

 NSString *str_img = [NSString stringWithFormat:@"%@uploads/%@-5.jpg",app.Main_url,[Data_Dict objectForKey:@"deal_id"]];
             //NSLog(@"%@",str_img);  


  NSDictionary *params = @{
                             @"name" : str_name,
                             @"caption" : @"",
                             @"description" : @"",
                             @"picture" : str_img,
                             @"link" : str_link,
                             @"to":str_id,
                             };


    // Invoke the dialog
    [FBWebDialogs presentFeedDialogModallyWithSession:nil
                                           parameters:params
                                              handler:
     ^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
         if (error) {
             NSLog(@"Error publishing story.");
             [self.indicator stopAnimating];
         } else {
             if (result == FBWebDialogResultDialogNotCompleted) {
                 NSLog(@"User canceled story publishing.");
                 [self.indicator stopAnimating];
             } else {
                 NSLog(@"Story published.");
                 [self.indicator stopAnimating];
             }
         }}];