如何在IOS应用程序的朋友墙上发布 Facebook Feed ?
答案 0 :(得分:0)
在对话框中,我们会向朋友/ Piblic / Me提出隐私要求隐私
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
// Initialize Compose View Controller
SLComposeViewController *vc = nil;
vc = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
// Configure Compose View Controller
[vc setInitialText:self.captionTextField.text];
[vc addImage:self.image];
[vc setCompletionHandler:^(SLComposeViewControllerResult result){
if (result == SLComposeViewControllerResultDone) {
[[[UIAlertView alloc] initWithTitle:@"Congratulations" message:@"Your post is successfully Posted" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
}else{
}
}];
// Present Compose View Controller
[self presentViewController:vc animated:YES completion:nil];
} else {
NSString *message = @"It seems that we cannot talk to Facebook at the moment or you have not yet added your Facebook account to this device. Go to the Settings application to add your Facebook account to this device.";
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Oops" message:message delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
答案 1 :(得分:0)
通过Graph API,你无法发布到朋友的墙上,它已被弃用。
您可以使用Feed Dialog来调用对话框,用户可以将Feed发布给任何朋友,这里是代码:
NSMutableDictionary *params =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
@"An example parameter", @"description",
@"https://developers.facebook.com/ios", @"link",
nil];
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {}
];
检查documentation以获取更多详细信息和可用参数列表。