-canOpenURL:URL 失败:“fbauth2:/";(OSStatus 错误 -10814.)" [英] -canOpenURL: failed for URL: "fbauth2:/" (OSStatus error -10814.)"

查看:68
本文介绍了-canOpenURL:URL 失败:“fbauth2:/";(OSStatus 错误 -10814.)"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的应用程序中添加 Facebook 和 Google 注册,但我有这个问题

i'm adding Facebook and Google signup in my application but i have this issue

无法完成操作.-10814

The operation couldn’t be completed. -10814

在 Facebook 登录中,我不知道如何解决,这是我的 openUrl 的应用程序委托代码:

in the Facebook login and i don't know how to solve it, this is my app delegate code for the openUrl:

 func application(_ application: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any])
        -> Bool {

            if let fbSDKAppId = FBSDKSettings.appID(), url.scheme!.hasPrefix("fb(fbSDKAppId)"), url.host == "authorize" {
            var shouldOpen :Bool = FBSDKApplicationDelegate.sharedInstance().application(application,  open: url, sourceApplication:options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String!,annotation:options[UIApplicationOpenURLOptionsKey.annotation])
            return shouldOpen
            }
            else {
                return GIDSignIn.sharedInstance().handle(url,
                                                     sourceApplication:options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String,
                                                     annotation: [:])
                }

            }

我能做什么?

推荐答案

现在我使用了从 here 我跟着链接a> 为 FB 安装的步骤.我的代码是

now I used the latest SDK v4.26.0 downloaded from here and I followed the link for steps to install for FB. and my code is

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];

if ([[[UIDevice currentDevice] systemVersion] floatValue] <= 9) {
    // After iOS9 we can not use it anymore
    login.loginBehavior = FBSDKLoginBehaviorSystemAccount;
} else {
    login.loginBehavior = FBSDKLoginBehaviorWeb;
}

NSArray *permission = [[NSArray alloc] initWithObjects:@"email",@"public_profile",@"user_friends", nil];
NSLog( @"### running FB sdk version: %@", [FBSDKSettings sdkVersion] );

[login logInWithReadPermissions:permission fromViewController:(UIViewController *)self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
    [self removeActivityIndicatorWithBg:activityIndicator];

    if (error) {
        NSLog(@"Process error");
    } else if (result.isCancelled) {
        NSLog(@"Cancelled");
    } else {
        NSLog(@"Logged in%@",result.grantedPermissions);
    }
}];

这里我使用的登录行为是 FBSDKLoginBehaviorSystemAccount 并且我得到的错误是

here i used the login behavior as FBSDKLoginBehaviorSystemAccount and I get the error as

(- 错误:操作无法完成.-10814)

(- error: "The operation couldn’t be completed. -10814)

所以在我的模拟器或设备中没有在系统设置中为 Facebook 设置帐户.然后它出现在以下块

so in my simulator or device contains no accounts setup in system settings for facebook. then it comes on the following block

if (error) {
    NSLog(@"Process error");
}

如果我打印错误,

没有 Facebook 帐户.没有配置 Facebook 帐户.您可以在设置"中添加或创建 Facebook 帐户.

所以我将 loginBehavior 从 FBSDKLoginBehaviorSystemAccount 更改为 FBSDKLoginBehaviorWeb,我得到了所有 OP,没有错误

so I changed the loginBehavior from FBSDKLoginBehaviorSystemAccount to FBSDKLoginBehaviorWeb, I got all OP with out error

这篇关于-canOpenURL:URL 失败:“fbauth2:/";(OSStatus 错误 -10814.)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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