2013-02-15 117 views
0

我使用SLComposeViewController將文章分享到Facebook。這是我用來使用SLComposeViewController共享文章的代碼。SLComposeViewController,共享不起作用

SLComposeViewController * facebookViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];

if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) 
    { 
     SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResult result) 
     { 

      [facebookViewController dismissViewControllerAnimated:YES completion:nil]; 

      switch(result){ 
       case SLComposeViewControllerResultCancelled: 
       default: 
       { 
        [[[UIAlertView alloc] initWithTitle:@"Result" 
               message:@"Story not posted" 
               delegate:nil 
             cancelButtonTitle:@"OK" 
             otherButtonTitles:nil] 
        show]; 

        [self dismissView]; 

       } 
        break; 
       case SLComposeViewControllerResultDone: 
       { 
        [[[UIAlertView alloc] initWithTitle:@"Result" 
               message:@"Story posted successfully" 
               delegate:nil 
             cancelButtonTitle:@"OK" 
             otherButtonTitles:nil] 
        show]; 

        [self dismissView]; 

       } 
        break; 
      }}; 

     [facebookViewController addImage:_shareImage]; 
     [facebookViewController setInitialText:_shareTitle]; 
     [facebookViewController addURL:_shareLink]; 
     [facebookViewController setCompletionHandler:completionHandler]; 

     [self.dashboard presentViewController:facebookViewController animated:YES completion:nil]; 

我得到在完成處理程序的響應爲SLComposeViewControllerResultDone,但文章並沒有在Facebook的wall.Is出現在這個與SDK的問題???

回答

-2

我沒有導入社會框架header.Hence它沒有張貼文章在牆上

+1

如果不導入框架,那麼你就沒有能夠編譯代碼。 – 2015-10-29 16:01:15

相關問題