2012-10-08 163 views
15

我這樣做,是在這裏解釋所有的步驟:https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/3.1/設置按鈕不工作

我已經測試演示項目和失敗一樣在我的項目。 (你可以在HelloFacebookSample項目上測試它)。

如果您沒有配置任何Facebook帳戶,則無法在Facebook上分享內容或上傳圖片等(與Twitter框架相同)。因此,框架向您顯示一條消息,告訴您:

沒有配置Facebook帳戶。您可以在設置中添加或創建Facebook帳戶。

您點擊設置,但唯一發生的事情是該對話框被隱藏,但框架不會打開設置選項卡(例如在twitter框架上工作)。

有誰知道如何解決這個問題?

在此先感謝。

+0

我有同樣的錯誤。我發現的唯一的事情是,這個錯誤只在模擬器上。儘管如此,我現在還沒有iOS 6設備,所以我無法測試它是否屬實。 – valdistt

回答

1

請使用SLComposeViewController類進行Facebook分享,設置按鈕爲您工作。

if([SLComposeViewController class]) 
{ 
    SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; 
    [controller setInitialText:text]; 
    [controller addURL:[NSURL URLWithString:encod]]; 
    [self presentViewController:controller animated:YES completion:Nil]; 
    //[message release]; 

    SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result) 
    { 
     NSString *output= nil; 
     switch (result) 
     { 
      case SLComposeViewControllerResultCancelled: 
       output= @"Action Cancelled"; 
       break; 
      case SLComposeViewControllerResultDone: 
       output= @"Post Succesfull"; 
       [self displayText:@"done"]; 
       break; 
      default: 
       break; 
     } 

    }; 
    controller.completionHandler =myBlock; 
} 

此代碼爲我工作

0

你爲什麼不u使用UIActivityViewController? iOS 6中有最好的支持與UIActivityViewController

UIActivityViewController *ActivityView = [[UIActivityViewController alloc] initWithActivityItems:Items applicationActivities:nil]; 

最佳整合了Facebook,Twitter和短信服務