簡體   English   中英

如何使用Facebook SDK 3.1在iOS 6中向選定的Facebook朋友發送消息?

[英]How to send message to selected facebook friend in ios 6 with Facebook sdk 3.1?

在我的應用程序中,我得到了已登錄用戶的好友列表,並且通過選擇任何一個我都可以獲取他的詳細信息,例如姓名,照片,身份證等。

但是我的問題是,我需要通過使用Facebook SDK 3.1的id之類的詳細信息向選定用戶發送消息。

如果您想發布到用戶牆,請嘗試以下方法:

    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];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM