如何在 IOS 6 上将带有一张图片的状态消息发布到 Facebook?
问问题
962 次
1 回答
3
添加图像
[controller addImage:[UIImage imageNamed:@"fb.png"]];
这是完整的代码片段
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
if (result == SLComposeViewControllerResultCancelled) {
NSLog(@"Cancelled");
} else
{
NSLog(@"Done");
}
[controller dismissViewControllerAnimated:YES completion:Nil];
};
controller.completionHandler =myBlock;
[controller setInitialText:@"Test Post from mobile.safilsunny.com"];
[controller addURL:[NSURL URLWithString:@"http://www.mobile.safilsunny.com"]];
[controller addImage:[UIImage imageNamed:@"fb.png"]];
[self presentViewController:controller animated:YES completion:Nil];
}
else{
NSLog(@"UnAvailable");
}
如果您想逐步检查将 Facebook 集成到 iOS 中的过程,请查看我的文章,该文章列在我的博客文章中
于 2012-09-21T10:05:33.840 回答