如何使用Xcode 5在朋友墙上发布链接或文字?有些方法在facebook SDK中被折旧。我使用以下代码在朋友的墙上发帖。
NSMutableDictionary *parmaDic = [NSMutableDictionary dictionaryWithCapacity:5];
[parmaDic setObject:link forKey:@"link"]; // if you want send picture
[parmaDic setObject:@"NAME" forKey:@"name"]; // if you want to display name
[parmaDic setObject:message forKey:@"description"]; // if you want to display description
[parmaDic setObject:@"FRIEND_FACEBOOK_ID" forKey:@"to"];
[parmaDic setObject:@"LOGO_URL" forKey:@"picture"]; // if you want to send App logo
[FBWebDialogs presentFeedDialogModallyWithSession:nil parameters:parmaDic handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
}
答案 0 :(得分:1)
您可以使用FBWebDialogs
类Facebook SDK
在朋友留言墙上发帖。为此,您需要在字典中的参数中的朋友facebook id,如下所示
NSMutableDictionary *parmaDic = [NSMutableDictionary dictionaryWithCapacity:5];
[parmaDic setObject:link forKey:@"link"]; // if you want send picture
[parmaDic setObject:@"NAME" forKey:@"name"]; // if you want to display name
[parmaDic setObject:message forKey:@"description"]; // if you want to display description
[parmaDic setObject:@"FRIEND_FACEBOOK_ID" forKey:@"to"];
[parmaDic setObject:@"LOGO_URL" forKey:@"picture"]; // if you want to send App logo
[FBWebDialogs presentFeedDialogModallyWithSession:nil parameters:parmaDic handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Case A: Error launching the dialog or sending request.
// NSLog(@"Error sending request.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// Case B: User clicked the "x" icon
// NSLog(@"User canceled request.");
} else {
// NSLog(@"Successfully Invited.");
}
}
}];