问题
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=privacy
to retrieve the privacy settings array.
来源:https://stackoverflow.com/questions/35333989/get-set-audience-for-open-graph-post