3

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.

iBobo
  • 714
  • 8
  • 13
  • I'm having exactly same issue and haven't found the solution yet. Please, post the solution if you find one. – m9__ Feb 10 '14 at 10:46
  • Having similar problems did you get this issue sorted out? – ORStudios Feb 19 '14 at 10:54
  • I am having this problem too. My [question](https://stackoverflow.com/questions/22329683/facebook-open-graph-share-from-ios-not-working-without-hitting-open-graph-debugg#comment34172006_22329683) has more technical details on what's going on. If you are still having this issue please try the workaround in my question. – Hugo Tunius Mar 17 '14 at 22:46

1 Answers1

2

I had the same issue while creating a new app. The Open Graph tags have to be exactly correct, or you won't be able to publish your story.

Check to make sure the objects and actions created in the Facebook app dashboard match what you have listed in the code.

object = [FBGraphObject openGraphObjectForPostWithType:@"boobs-teller:question"

In this line, "boobs-teller" should be what you have listed as your App's namespace(Facebook Apps > Settings > Basic), and "questions" should be the custom Object (Open Graph > Object Types) you created in the App dashboard. If you haven't created these yet, go here: https://developers.facebook.com/apps

params.actionType = @"boobs-teller:ask";

In this line, "boobs-teller" should be your app namespace, and "ask" is the custom Action (Open Graph > Action Types) you created in the app dashboard.

More details are here: https://developers.facebook.com/docs/ios/open-graph/

You can also check the sample iOS apps on GitHub, the FBOGSampleSD app helped me out a lot while learning Open Graph. https://github.com/fbsamples/ios-howtos

John Blanchard
  • 195
  • 2
  • 11
  • I'm super sure they're correct... and still can't solve the problem. – iBobo Mar 18 '14 at 12:20
  • Have you submitted the custom Open Graph story to Facebook and had it approved? – John Blanchard Mar 27 '14 at 15:52
  • I wish there was an error message instead of the weird behavior. I spent hours looking through the SDK, examples, and SO. Turns out I had put a . instead of a : between my namespace and my action name. – Carlos Jul 24 '14 at 11:03