Created
July 22, 2015 14:25
-
-
Save tadamatu/92779747c27b8f957d4d to your computer and use it in GitHub Desktop.
Facebookへの投稿
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://tadamatu.blogspot.jp/2015/07/ios.html