I have created a custom open graph object, action and story on Facebook developer website, then followed the tutorial to be able to post it through the official FB app (without login in the app). This is the code:
NSMutableDictionary<FBGraphObject> *object;
NSString *returnUrl = [NSString stringWithFormat:@"http://tettomante.it/questions?%@",
[NSString stringWithURLParams:@{@"answer": _answerLabel.text, @"divination": [self divinationNickname]}]];
object = [FBGraphObject openGraphObjectForPostWithType:@"boobs-teller:question"
title:_questionTextView.text
image:@"https://d1rdorpdffwq56.cloudfront.net/icona_tettomante.jpg"
url:returnUrl
description:_answerLabel.text];
NSMutableDictionary<FBOpenGraphAction> *action = (NSMutableDictionary<FBOpenGraphAction> *) [FBGraphObject openGraphActionForPost];
action[@"question"] = object;
// Check if the Facebook app is installed and we can present the share dialog
FBOpenGraphActionShareDialogParams *params = [[FBOpenGraphActionShareDialogParams alloc] init];
params.action = action;
params.actionType = @"boobs-teller:ask";
params.previewPropertyName = @"question";
// If the Facebook app is installed and we can present the share dialog
if([FBDialogs canPresentShareDialogWithOpenGraphActionParams:params]) {
// Show the share dialog
[FBDialogs presentShareDialogWithOpenGraphActionParams:params
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// There was an error
NSLog(@"Error publishing story: %@", error.description);
}
else {
// Success
NSLog(@"result %@", results);
}
}];
}
The problem is that once in the FB app the custom story preview appears correctly and after about 10 seconds disappears, while the "Publish" button on the top is disabled (greyed out) and doesn't enable itself. I don't understand what's going on. I thought that could be because the app was in sandbox mode (I was using the administrator user so that shouldn't have mattered), so I made it public but nothing changed. Then I thought I had to make FB review the custom action, so I had that sorted out also, but nothing has changed. Now I don't know what to try next.