共享应用程序时产生的FBAppCall无效使用 - Facebook应用程序ID未注册为URL方案 [英] 'Invalid use of FBAppCall' error produced when sharing app - Facebook app ID is not registered as a URL Scheme

查看:212
本文介绍了共享应用程序时产生的FBAppCall无效使用 - Facebook应用程序ID未注册为URL方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  NSMutableDictionary< FBGraphObject>我想通过Facebook分享我的应用程序,使用共享对话框* object = 
[FBGraphObject openGraphObjectForPostWithType:@whatsyourinneragefb:inner_age
title:@What's Your Inner Age
image:@https://fbstatic-a.akamaihd.net/图像/ devsite / attachment_blank.png
url:@http://samples.ogp.me/578838518886846
描述:@每个人都发现他们的内心世界除了你!现在下载并发现你的!];

NSLog(@1);

//创建一个动作

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) {
//处理结果
}];

NSLog(@3);
//将对象链接到动作
[action setObject:object forKey:@whatsyourinneragefb:inner_age];
NSLog(@4);
//检查是否安装了Facebook应用程序,我们可以显示共享对话框
FBOpenGraphActionParams * params = [[FBOpenGraphActionParams alloc] init];
params.action = action;
params.actionType = @whatsyourinneragefb:inner_age;
NSLog(@5);
//如果安装了Facebook应用程序,我们可以显示共享对话框
if([FBDialogs canPresentShareDialogWithOpenGraphActionParams:params]){
//显示共享对话框
[FBDialogs presentShareDialogWithOpenGraphAction :action
actionType:@whatsyourinneragefb:inner_age
previewPropertyName:@whatsyourinneragefb:inner_age
处理程序:^(FBAppCall *调用,NSDictionary *结果,NSError *错误){
if(error){
//有一个错误
NSLog([NSString stringWithFormat:@错误发布故事:%@,error.description]);
} else {
// Success
NSLog(@result%@,results);
}
}];
NSLog(@6);
//如果Facebook应用未安装,我们无法显示共享对话框
} else {

// FALLBACK GOES HERE

NSLog(@你没有Facebook!);

}

但是,当我分享应用程序时,以下错误生成:

  FBSDKLog:FBAppCall无效使用,fb578756542228377未注册为URL Scheme。你的plist中设置了FacebookUrlSchemeSuffix吗? 

然而,我在代码中使用的ID与我的info.plist文件中使用的ID相同,如下图所示:





此外,日志表明,产生错误的代码是5和6日志之间的密码,如果这有帮助在所有

解决方案

尝试添加其他方式的模式,如下所示:




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:

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

解决方案

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

这篇关于共享应用程序时产生的FBAppCall无效使用 - Facebook应用程序ID未注册为URL方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆