Skip to content

Instantly share code, notes, and snippets.

@tadamatu
Created July 22, 2015 14:25
Show Gist options
  • Save tadamatu/92779747c27b8f957d4d to your computer and use it in GitHub Desktop.
Save tadamatu/92779747c27b8f957d4d to your computer and use it in GitHub Desktop.
Facebookへの投稿
//Facebookへの投稿
//※Social.frameworkの追加が必要
void postFacebook(NSString *text, NSString *url, NSString *image) {
SLComposeViewController *facebookPostVC = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[facebookPostVC setInitialText:text];
[facebookPostVC addURL:[NSURL URLWithString:url]];
[facebookPostVC addImage:[UIImage imageNamed:image]];
[facebookPostVC setCompletionHandler:^(SLComposeViewControllerResult result) {
if (result == SLComposeViewControllerResultDone) {
//投稿完了の処理
}
}];
[ViewController presentViewController:facebookPostVC animated:YES completion:nil];
}
@tadamatu
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment