1

I am attempting to share my app via Facebook using the share dialog, with the following code:

NSMutableDictionary<FBGraphObject> *object =
[FBGraphObject openGraphObjectForPostWithType:@"whatsyourinneragefb:inner_age"
                                        title:@"What's Your Inner Age"
                                        image:@"https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png"
                                          url:@"http://samples.ogp.me/578838518886846"
                                  description:@"Everyone's finding out their inner ages apart from you! Download now and discover yours!"];;

NSLog(@"1");

// Create an action

NSMutableDictionary<FBGraphObject> *action = [FBGraphObject graphObject];
action[@"inner_age"] = @"http://samples.ogp.me/578838518886846";

NSLog(@"2");

[FBRequestConnection startForPostWithGraphPath:@"fb578756542228377"
                                   graphObject:action
                             completionHandler:^(FBRequestConnection *connection,
                                                 id result,
                                                 NSError *error) {
                                 // handle the result
                             }];

NSLog(@"3");
// Link the object to the action
[action setObject:object forKey:@"whatsyourinneragefb:inner_age"];
NSLog(@"4");
// Check if the Facebook app is installed and we can present the share dialog
FBOpenGraphActionParams *params = [[FBOpenGraphActionParams alloc] init];
params.action = action;
params.actionType = @"whatsyourinneragefb:inner_age";
NSLog(@"5");
// 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:@"whatsyourinneragefb:inner_age"
                                 previewPropertyName:@"whatsyourinneragefb:inner_age"
                                             handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
                                                 if(error) {
                                                     // There was an error
                                                     NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]);
                                                 } else {
                                                     // Success
                                                     NSLog(@"result %@", results);
                                                 }
                                             }];
    NSLog(@"6");
    // If the Facebook app is NOT installed and we can't present the share dialog
} else {

    // FALLBACK GOES HERE

    NSLog(@"You don't have Facebook!");

}  

However, when I share the app, the following error is produced:

FBSDKLog: Invalid use of FBAppCall, fb578756542228377 is not registered as a URL Scheme. Did you set 'FacebookUrlSchemeSuffix' in your plist?  

However, the ID I use in code is identical to the one used in my info.plist file, as shown in this screenshot:

enter image description here

Also, the logs suggest that the code producing the error is between the logs of "5" and "6", if this helps at all.

bummi
  • 27,123
  • 14
  • 62
  • 101
Isaac A
  • 361
  • 2
  • 24

1 Answers1

0

Try to add the schema of other way, like this:

Community
  • 1
  • 1
user237474
  • 21
  • 2