我按照有關發佈使用Facebook SDK爲iOS定製的Open Graph故事教程:https://developers.facebook.com/docs/ios/open-graph/如何選擇要爲我的自定義Open Graph故事發布的靈活句子結構?
我也讀到靈活的句子結構,這裏的文檔:https://developers.facebook.com/docs/opengraph/creating-custom-stories/#variations
我的問題是,如何以及在何處在代碼中指定要使用哪個特定的句子結構?我想發佈「John Doe煮熟牛排」而不是「John Doe煮熟飯」。我想使用One-to-One句子結構而不是一對一無對象標題結構。
// Create an object
id<FBGraphObject> object =
[FBGraphObject openGraphObjectForPostWithType:@"myapp:meal"
title:@"Steak"
image:@"http://i.imgur.com/g3Qc1HN.png"
url:@"https://example.com/link/"
description:@"Juicy and medium-rare"];
// Create an action
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
// Link the object to the action
[action setObject:object forKey:@"meal"];
// Check if the Facebook app is installed and we can present the share dialog
FBOpenGraphActionShareDialogParams *params = [[FBOpenGraphActionShareDialogParams alloc] init];
params.action = action;
params.actionType = @"myapp:cook";
// If the Facebook app is installed and we can present the share dialog
if([FBDialogs canPresentShareDialogWithOpenGraphActionParams:params])
{
// Show the share dialog
[FBDialogs presentShareDialogWithOpenGraphAction:action
actionType:@"myapp:cook"
previewPropertyName:@"recipe"
handler:
^(FBAppCall *call, NSDictionary *results, NSError *error)
{
if(error) {
// There was an error
NSLog(@"Error publishing story: %@", error.description);
} else {
// Success
NSLog(@"result %@", results);
}
}];
}
看來@estemendoza是在正確的有一個非常有限的事情,你作爲一名開發人員可以做影響句子結構列表。在大多數情況下,Facebook會自行決定,例如,如果附加的預覽包含標題,則FB將顯示沒有標題結構的1比1。這是這樣的,它不會在相同的帖子內兩次顯示標題文本,靠近。 – weiy