如何使用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向ios 6中的所选Facebook好友发送消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序中,我正在获取登录用户的朋友列表,通过选择任何一个,我可以获取他的详细信息,如姓名,照片,身份证等。
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.
但是我的问题是我需要使用他的详细信息(例如id与Facebook SDK 3.1)向所选用户发送消息。
But my question is that I need to send message to selected user by using his details like id with Facebook SDK 3.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];
这篇关于如何使用Facebook sdk 3.1向ios 6中的所选Facebook好友发送消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文