简体   繁体   English

如何在iOS的Facebook打开图故事中显示自定义对象?

[英]How to display custom objects in facebook open graph stories for iOS?

I'm working on a project, where I'm posting custom stories on user's facebook timeline once they request a song from my app. 我正在做一个项目,当用户从我的应用程序请求播放歌曲时,我会在该项目上将自定义故事发布在用户的Facebook时间轴上。 I created an OG story on facebook developers portal. 我在Facebook开发人员门户上创建了一个OG故事。 The story would look similar to, 这个故事看起来类似于

'Kevin requested a song using myAppName' “凯文使用myAppName请求了一首歌”

I integrated the code and it gets posted on the wall. 我集成了代码,并将其张贴在墙上。 Works fine. 工作正常。 Now I face two issues in the process. 现在,我在此过程中面临两个问题。

  1. How to pass a custom song name? 如何传递自定义歌曲名称? Even though I send the song name as one of the parameter to FBSDKOpenGraphObject, it keeps displayed as 'Sample Album'. 即使我将歌曲名称作为参数之一发送到FBSDKOpenGraphObject,它也始终显示为“样本专辑”。 How would I display my own song name like, 我将如何显示自己的歌曲名称,例如,

'Kevin requested the song never say never using myAppName' 凯文(Kevin)要求这首歌永远不要说永远不要使用myAppName'

  1. My second issue is. 我的第二个问题是。 Even though the post is getting posted, I couldn't see in my timeline. 即使该帖子被发布,我也无法在时间轴中看到。 However, I can see it on my Activitylog on my wall. 但是,我可以在墙上的Activitylog上看到它。 I have turned on 'Explicitly Shared' option on the OG story. 我已经在OG故事中启用了“显式共享”选项。

Ideas are appreciated. 想法被赞赏。

1. For posting a story you need to setup object and action first. 1.要发布故事,您需要首先设置对象和动作。 In your case you have set Requested as action and Song as Object. 在您的情况下,您已将Requested设置为action并将Song设置为Object。 Right? 对?

Now for every Song you need to setup an object with its own properties if you want to display it in post. 现在,对于每首歌曲 ,如果要在后期显示它,则需要设置一个具有其自身属性的对象。

  • Go to your story in developer portal and click on Get Code button. 在开发人员门户中转到您的故事,然后单击“ 获取代码”按钮。
  • Click on Code for Object and select your platform IOS SDK and you can see there is this property @"og:title": @"Sample Song" . 单击“对象代码”,然后选择平台IOS SDK ,您可以看到此属性@"og:title": @"Sample Song" Here you can set your song title. 您可以在此处设置歌曲标题。

在此处输入图片说明

  • When posting an action you need to give object url of that specific song as parameter in action code. 发布动作时,您需要提供该特定歌曲的对象网址作为动作代码中的参数。 here: [action setString:@"http://samples.ogp.me/677267592407093" forKey:@"level"]; 此处: [action setString:@"http://samples.ogp.me/677267592407093" forKey:@"level"];

2. Before you can publish stories for people using your app, you'll have to submit them for review . 2.在使用您的应用为他人发布故事之前,您必须将其提交进行审查

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM