我正在尝试在Facebook与SDK 4.5集成中发布自定义开放图形故事,但我无法发布它。我在我的代码中创建了一个对象和动作
我收到此错误:
Failed to generate preview for user.com.facebook.http.
protocol.ApiException: [code] 100 [message]: (#100)
App xxxx is not allowed to create actions of type
restaurant:Wants To Visit for user xxxxx [extra]:
我的代码:
public void SongRequest(){
try {
// Create an object
ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
.putString("og:type", "restaurant.restaurant")
.putString("og:title", "Peddlers")
.putString("og:image", "https://scontent.fdel1-1.fna.fbcdn.net/hphotos-xpt1/v/t1.0-9/11996901_943588275699701_6661729706633501716_n.jpg?oh=5ebb6e29eff2009e0f4c68f86b06923d&oe=56A8B7CE")
.putString("og:description", "Peddlers Under The Big Ben")
.putString("restaurant:contact_info:street_address", "1601 Willow Rd.")
.putString("restaurant:contact_info:locality", "Menlo Park")
.putString("restaurant:contact_info:region", "California")
.putString("restaurant:contact_info:postal_code", "160022")
.putString("restaurant:contact_info:country_name", "India")
.putString("restaurant:contact_info:email", "brian@example.com")
.putString("restaurant:contact_info:phone_number", "212-555-1234")
.putString("restaurant:contact_info:website", "https://www.facebook.com/peddlersrock")
.putString("place:location:latitude", "30.70516586")
.putString("place:location:longitude", "76.8010025")
.putString("og:url", "https://www.facebook.com/CompetentGroove")
.build();
//Then create an action and link the object to the action.
// Create an action
ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
.setActionType("restaurant.wants_to_visit")
.putObject("restaurant", object)
.build();
//Finally, create the content model to represent the Open Graph story.
// Create the content
ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
.setPreviewPropertyName("restaurant")
.setAction(action)
.build();
//Present the Share dialog by using the show method on ShareDialog.
ShareDialog.show(HelloFacebookSampleActivity.this, content);
} catch (Exception e) {
Log.e("Graph Stories.Exception", e.toString());
}
}