2

我用SLComposeViewController共享圖像和URL的如下:我們可以使用SLComposeViewController在FB上共享視頻嗎?

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 *[email protected]"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共享視​​頻文件。 在此先感謝。

回答

4

不,我們不能使用SLComposeViewController共享視​​頻文件。對於發送視頻文件,我們必須

使用Fb圖形API。請參閱此鏈接&使用它,你可以很容易地能夠發送視頻文件FB:

http://developers.facebook.com/blog/post/2011/08/04/how-to--use-the-graph-api-to-upload-a-video--ios/

+1

對不起,我已經實現了。我只想知道視頻共享是可以通過社交框架或不。 – Warewolf

+3

好吧,但我認爲不是不可能... – Vishal

+0

好的,謝謝你的回覆。 – Warewolf

0

如果你想分享一個視頻網址到了Facebook,你可以使用下面的代碼。

SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; 
[controller setInitialText:string]; 
[controller addImage:image]; 
[controller addURL:[NSURL URLWithString:URLString]]; 
[self.controller presentViewController:controller animated:YES completion:Nil]; 
[controller setCompletionHandler:^(SLComposeViewControllerResult result){ 
      switch (result) { 
       case SLComposeViewControllerResultCancelled: 
        // Cancelled 
        break; 

       case SLComposeViewControllerResultDone: 
        // Success 
        break; 

       default: 
        break; 
      } 
     }]; 
+0

這不起作用,Facebook不允許您使用SLComposeViewController共享視​​頻。正如Vishal上面所說,你需要使用教程[here]。(http://developers.facebook.com/blog/post/2011/08/04/how-to--use-the-graph-api -to-上載一個視頻 - IOS /) –

相關問題