Facebook Sharing with image and Applinks

萝らか妹 提交于 2019-12-25 06:34:25

问题


I stuck on the Facebook sharing..

All I want is to post an image from my iOS app, with text and applink, that can redirect users to installed app or App Store.

App link works fine, I described some metatags like this:

    <meta property="al:ios:url" content="cubeDev://" />
    <meta property="al:ios:app_store_id" content="1054030..." />
    <meta property="al:ios:app_name" content="My app name" />
    <meta property="al:web:should_fallback" content="false" />
    <meta property="og:image:width" content="50" />
    <meta property="og:image:height" content="50" />
    <meta property="og:image" content="https://spb.hh.ru/employer-logo/1625583.png" />
    <meta property="og:type" content="website" />
    <meta property="og:title" contetn="title" /> 
    <meta property="og:description" content="App description.." />
    <meta property="fb:app_id" content="31667067867..." />  

Share code also pretty simple:

 FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
  content.contentURL = [NSURL URLWithString:@"http://176.31.132.151:8000/"];
  content.imageURL = [feedCell imageURL];
  content.quote = [feedCell text];

  FBSDKShareDialog *shareDialog = [[FBSDKShareDialog alloc] init];
  shareDialog.mode = FBSDKShareDialogModeNative;
  if(!shareDialog.canShow) {
    shareDialog.mode = FBSDKShareDialogModeFeedBrowser;
  }
  shareDialog.fromViewController = self;
  shareDialog.shareContent = content;
  shareDialog.delegate = self;
  [shareDialog show]; 

Where http://176.31.132.151:8000/ is my app link.

It seems like when you describe an image in meta tags for app link, image url property won't work..

So, my goal is to post an image from app with text, and app link below with my app icon and description..

Will be grateful for any help.


回答1:


After visiting Facebook bugs page

I found an explanation of this behavior by one of Facebook team's member and it seems like that there is no way to do that with current fb sdk, the only solution is to create an app link page with dynamically parameters.. not so good as I expected.

Roemer Vlasveld · · Facebook Team Hi Deepak,

...

It turns out that this behaviour is by design. In the past, the experience with sharing both a photo and a link caused a mixed experience. Currently, when sharing both a photo and a link, only the link will be used to create a preview.

The workaround would be to add the photo as an Open Graph image to the link that will be shared. This might require that each link is unique, but that will ensure that the preview created (at least in the created post) uses the image from the provided link.

I will mark this bug as 'By Design', since it reflects intended behavior. If you still encounter problems with this, feel free to reopen by leaving a new comment or reply.

Roemer



来源:https://stackoverflow.com/questions/38525095/facebook-sharing-with-image-and-applinks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!