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

孤人 提交于 2019-12-11 10:26:32

问题


In my application I'm getting friend list of logged in user and by selecting any one I can get his details like name, photo, id etc.

But my question is that I need to send message to selected user by using his details like id with Facebook SDK 3.1.


回答1:


if you want to post to users wall try this one :

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


来源:https://stackoverflow.com/questions/14392929/how-to-send-message-to-selected-facebook-friend-in-ios-6-with-facebook-sdk-3-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!