作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我想从我的应用程序发送好友请求。我使用了以下代码
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"My Title", @"title",
@"Come check out my app.", @"message",
FrienduserId, @"id",
nil];
[FBWebDialogs
presentDialogModallyWithSession:nil
dialog:@"friends"
parameters:[params mutableCopy]
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error){
if (error) {
NSLog(@"%@",error);
}
else
{
NSLog(@"done");
}
}];
它显示对话框,当我点击确认时它会给出消息抱歉出了点问题。我们正在努力尽快解决此问题。
我已经成功集成了 Facebook SDK。我得到了我的个人资料信息和我的 friend 列表。所以请帮我解决这个问题。
最佳答案
NSLog(@"%@",[app.Arr_Facebook_Frnd objectAtIndex:indexpath]);
NSString *str_id;
NSString *str_name;
NSString *str_link;
str_id = [[app.Arr_Facebook_Frnd objectAtIndex:indexpath] objectForKey:@"id"];
str_name = [[app.Arr_Facebook_Frnd objectAtIndex:indexpath] objectForKey:@"name"];
str_link = @"www.google.com";
NSDictionary *params = @{
@"name" : str_name,
@"caption" : @"",
@"description" : @"",
@"picture" : @"",
@"link" : str_link,
@"to":str_id,
};
// Invoke the dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:
^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
NSLog(@"Error publishing story.");
[self.indicator stopAnimating];
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
NSLog(@"User canceled story publishing.");
[self.indicator stopAnimating];
} else {
NSLog(@"Story published.");
[self.indicator stopAnimating];
}
}}];
关于ios - 如何从 iOS 应用程序发送好友请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21575516/
我是一名优秀的程序员,十分优秀!