【问题标题】:FBSDKSharePhoto caption not showingFBSDKSharePhoto 标题未显示
【发布时间】:2015-12-19 13:05:01
【问题描述】:

我正在尝试使用 ShareDialog 将照片分享到 Facebook,这是我的代码 -

let photo = FBSDKSharePhoto()
photo.image = takeShot()
photo.caption = blessing.text
photo.userGenerated = true

let content = FBSDKSharePhotoContent()
content.photos = [photo]
FBSDKShareDialog.showFromViewController(self, withContent: content, delegate: self)

问题是ShareDialog出现时只能看到照片,标题不显示?

我该如何解决?

【问题讨论】:

    标签: ios xcode facebook swift facebook-graph-api


    【解决方案1】:

    如果您想在没有任何 FB 对话框屏幕的情况下静默分享,请使用以下“shareWithContent”,但您需要提交您的 Facebook 应用以供审核。

    Obj-c 中的代码

    FBSDKSharePhoto *sharePhoto = [[FBSDKSharePhoto alloc] init];
    sharePhoto.caption = @"Test Caption";
    sharePhoto.image = [UIImage imageNamed:@"BGI.jpg"];
    
    FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
    content.photos = @[sharePhoto];
    
    [FBSDKShareAPI shareWithContent:content delegate:self];
    

    Swift 中的代码

    var sharePhoto = FBSDKSharePhoto()
    sharePhoto.caption = "Test"
    sharePhoto.image = UIImage(named: "BGI.jpg")
    
    var content = FBSDKSharePhotoContent()
    content.photos = [sharePhoto]
    
    FBSDKShareAPI.shareWithContent(content, delegate: self)
    

    【讨论】:

      猜你喜欢
      • 2011-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多