2012-12-16 68 views
0

我在iOS應用中包含了Facebook本地共享對話框,以讓用戶共享一些數據。問題是,對話框沒有打開。這是代碼。此外,我傳遞圖像的URL到該方法是正常的?也許,這是問題所在?Facebook SDK for iOS 6.0本地共享對話框

BOOL displayedNativeDialog = 
     [FBNativeDialogs 
      presentShareDialogModallyFrom:self 
      initialText:activityName 
      image:activityImageURL 
      url:activityURL 
      handler:^(FBNativeDialogResult result, NSError *error) { 
      if (error) { 
       NSLOG(@"Error occured"); 
      } else { 
       if (result == FBNativeDialogResultSucceeded) { 
        NSLOG(@"Success"); 
       } else { 
        NSLOG(@"No success"); 
       } 
      } 
     }]; 
    if (!displayedNativeDialog) { 
     NSLOG("Window does notdisplayed"); 
    } 
+0

你可以通過零而不是圖像的URL來測試你的形象問題。此外,您是否通過iOS 6設置登錄到Facebook系統帳戶? –

回答

0

而不是 圖像:activityImageURL 通過UIImage的數據進行圖像 圖像:[UIImage的imageWithNamed:@ 「blahblah」]

0

您可以使用本地對話框用戶安裝Facebook應用程序,只有當。如果Facebook的應用程序可用,則首先檢查或者顯示本機對話框,或顯示相應網頁對話框:

FBShareDialogParams *shareParams = [[FBShareDialogParams alloc] init]; 
shareParams.link = [NSURL URLWithString:@"http://some-url.com"]; 
shareParams.name = @"Post Name"; 
shareParams.picture= [NSURL URLWithString:someImageURL]; 
shareParams.description = @"Post Description"; 

if ([FBDialogs canPresentShareDialogWithParams:shareParams]) 
{ 
    [FBDialogs presentShareDialogWithParams:shareParams 
           clientState:nil 
            handler:^(FBAppCall *call, NSDictionary *results, NSError *error) { 
             NSLog(@"%@", [error localizedDescription]); 
            }]; 
} 
else 
{ 
    NSDictionary *params = @{ 
          @"name" : shareParams.name, 
          @"description" : shareParams.description, 
          @"picture" : objectiveCharacterImageURL, 
          @"link" : linkURL 
          }; 

    [FBWebDialogs presentFeedDialogModallyWithSession:nil 
              parameters:params 
               handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) { 

               }]; 
} 
相關問題