如何将消息发送到选定的Facebook好友在iOS 6中与Facebook SDK 3.1?(How

2019-10-17 14:50发布

在我的应用我得到的登录用户,并通过选择任何一个我能得到他的详细资料,如姓名,照片,身份证等好友列表

但我的问题是,我需要通过使用类似与Facebook SDK 3.1 ID他的详细信息要发送消息给选定的用户。

Answer 1:

如果你要张贴到墙上的用户尝试这一个:

    NSMutableDictionary *postTest = [[NSMutableDictionary alloc]init];
    [postTest setObject:[NSString stringWithFormat@"Your message"] forKey:@"message"];
    [postTest setObject:@"" forKey:@"picture"];
    [postTest setObject:@"" forKey:@"name"];
    [postTest setObject:@"APPID" forKey:@"app_id"];
    NSString *userFBID =[NSString stringWithFormat:@"%@",[allInfoDict objectForKey:@"Friends facebook ID "]];

    [FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"%@/feed?access_token=%@",userFBID,[appDelegate.mysession accessToken]]
                                 parameters:postTest
                                 HTTPMethod:@"POST"
                          completionHandler:^(FBRequestConnection *connection,
                                              NSDictionary * result,
                                              NSError *error) {
                              if (error) {
                                  [self hideHUD];
                                  NSLog(@"Error: %@", [error localizedDescription]);

                              } else {
                                  // Success

                              }
                          }];

    [postTest release];


文章来源: How to send message to selected facebook friend in ios 6 with Facebook sdk 3.1?