【问题标题】:Facebook SDK for iOS 6.0 native Share dialogFacebook SDK for iOS 6.0 原生分享对话框
【发布时间】:2012-12-03 18:20:45
【问题描述】:

我在我的 iOS 应用程序中加入了 Facebook 原生分享对话框,让用户可以分享一些数据。问题是,对话框没有打开。这是代码。另外,我将图像的 URL 传递给方法是正常的吗?也许,这就是问题所在?

    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");
   }

【问题讨论】:

  • 您可以传递 nil 而不是图像 URL 来测试您的图像问题。另外,您是否通过 iOS 6 设置登录 Facebook 系统帐户?

标签: ios facebook share


【解决方案1】:

而不是 图像:活动图像URL 将 UIImage 数据传递给图像 图片:[UIImage imageWithNamed:@"blahblah"]

【讨论】:

    【解决方案2】:

    只有当用户安装了 Facebook 应用程序时,您才能使用本机对话框。首先检查 facebook 应用程序是否可用,然后显示本机对话框或相应地显示 Web 对话框:

    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) {
    
                                                  }];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-06-13
      • 2013-11-23
      • 2013-09-07
      • 1970-01-01
      • 2014-02-26
      • 1970-01-01
      • 2013-05-31
      相关资源
      最近更新 更多