如何在IOS中使用最新的facebook sdk在朋友墙上发布文字

时间:2014-02-24 04:54:21

标签: ios facebook ios7 facebook-sharer

如何使用Xcode 5在朋友墙上发布链接或文字?有些方法在facebook SDK中被折旧。我使用以下代码在朋友的墙上发帖。

NSMutableDictionary *parmaDic = [NSMutableDictionary dictionaryWithCapacity:5];
[parmaDic setObject:link forKey:@"link"];            // if you want send picture
[parmaDic setObject:@"NAME" forKey:@"name"];         // if you want to display name
[parmaDic setObject:message forKey:@"description"];  // if you want to display  description
[parmaDic setObject:@"FRIEND_FACEBOOK_ID" forKey:@"to"];
[parmaDic setObject:@"LOGO_URL" forKey:@"picture"];  // if you want to send App logo

[FBWebDialogs presentFeedDialogModallyWithSession:nil parameters:parmaDic handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)  {
    if (error) {

 }

1 个答案:

答案 0 :(得分:1)

您可以使用FBWebDialogsFacebook SDK在朋友留言墙上发帖。为此,您需要在字典中的参数中的朋友facebook id,如下所示

    NSMutableDictionary *parmaDic = [NSMutableDictionary dictionaryWithCapacity:5];
    [parmaDic setObject:link forKey:@"link"];            // if you want send picture
    [parmaDic setObject:@"NAME" forKey:@"name"];         // if you want to display name
    [parmaDic setObject:message forKey:@"description"];  // if you want to display  description
    [parmaDic setObject:@"FRIEND_FACEBOOK_ID" forKey:@"to"];
    [parmaDic setObject:@"LOGO_URL" forKey:@"picture"];  // if you want to send App logo

    [FBWebDialogs presentFeedDialogModallyWithSession:nil parameters:parmaDic handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)  {
        if (error) {

           // Case A: Error launching the dialog or sending request.
           // NSLog(@"Error sending request.");

        } else {

                if (result == FBWebDialogResultDialogNotCompleted) {

                    // Case B: User clicked the "x" icon
                    //    NSLog(@"User canceled request.");

                } else {    

                        //   NSLog(@"Successfully Invited.");

                  }
               }
         }];