Facebook Share Dialog Box on iOS: The Publish button is always grayed out

I created a custom open object, action, and story on the Facebook developers site, and then completed a tutorial to publish it through the official FB app (without accessing 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);
                                                       }
                                                   }];
}

, FB 10 , "" ( ) . , . , , ( , ), , . , FB , , . , .

+3
1

. Open Graph .

, , Facebook, , .

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

"boobs-teller" , ( " Facebook" > "" > "" ), "" ( > ), . , : https://developers.facebook.com/apps

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

"boobs-teller" , "ask" - (Open Graph > Action Types), .

: https://developers.facebook.com/docs/ios/open-graph/

iOS GitHub, FBOGSampleSD Open Graph. https://github.com/fbsamples/ios-howtos

+2

All Articles