Get/Set audience for Open Graph Post

女生的网名这么多〃 提交于 2019-12-02 08:20:38

问题


Is it possible to get OR set the audience (FRIENDS, ONLY ME, PUBLIC) of an Open Graph Story post? According to developers.facebook there should be a field for the privacy setting. My application does have the publish-permission:"publish_actions" and the read-permissions: "public_profile", "email", "user_posts".
When i make the following request (iOS):

FBSDKGraphRequest(graphPath: "postid", parameters: nil, HTTPMethod: "GET")

i get this response:

{
data =     {
    location =         {
        id = 00000000000;
        title = "Sample title";
        type = "my_namespace:location";
    };
};
"end_time" = "2016-02-01T09:35:35+0000";
id = postid;
"start_time" = "2016-02-01T09:35:35+0000";
type = "my_namespace:check_in";

}

It does not contain any type of privacy field. Is there a way to get it or even set it?


回答1:


According to

  • https://developers.facebook.com/docs/graph-api/reference/user/feed#publish

you can set the privacy field with an object of

{
    "value": "YOUR_VALUE"
}

where YOUR_VALUE must be one of 'EVERYONE', 'ALL_FRIENDS', 'FRIENDS_OF_FRIENDS', 'CUSTOM', 'SELF'.

Keep in mind that the privacy field

Determines the privacy settings of the post. If not supplied, this defaults to the privacy level granted to the app in the Login Dialog. This field cannot be used to set a more open privacy setting than the one granted.




回答2:


You must append the parameter ?fields=privacyto retrieve the privacy settings array.



来源:https://stackoverflow.com/questions/35333989/get-set-audience-for-open-graph-post

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