SLComposeViewControllerを使用して、次のように画像とURLを共有しました。
SLComposeViewController *fbComposer =
[SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeFacebook];
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
SLComposeViewControllerCompletionHandler __block completionHandler=
^(SLComposeViewControllerResult result){
[fbComposer dismissViewControllerAnimated:YES completion:nil];
switch(result){
case SLComposeViewControllerResultCancelled:
default:
{
NSLog(@"Cancelled.....");
}
break;
case SLComposeViewControllerResultDone:
{
NSLog(@"Posted....");
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Sent"
message:nil
delegate:nil
cancelButtonTitle:@"Dismiss"
otherButtonTitles: nil];
[alert show];
}
break;
}};
NSString *message=@"posting to FB test";
[fbComposer setInitialText:message];
[fbComposer addImage:[UIImage imageNamed:@"2.jpg"]];
[fbComposer addURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=GoZ2Be2zLq8"]];
[fbComposer setCompletionHandler:completionHandler];
[self presentViewController:fbComposer animated:YES completion:nil];
}
SLComposeViewControllerを使用してビデオファイルを共有することもできますか?前もって感謝します。