简体   繁体   中英

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. I created an OG story on facebook developers portal. The story would look similar to,

'Kevin requested a song using 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'. How would I display my own song name like,

'Kevin requested the song never say never using 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. I have turned on 'Explicitly Shared' option on the OG story.

Ideas are appreciated.

1. For posting a story you need to setup object and action first. In your case you have set Requested as action and Song as 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" . 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"];

2. Before you can publish stories for people using your app, you'll have to submit them for review .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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