gpt4 book ai didi

ios - -canOpenURL : failed for URL: "fbauth2:/" (OSStatus error -10814. )”

转载 作者:可可西里 更新时间:2023-11-01 03:09:46 25 4
gpt4 key购买 nike

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

The operation couldn’t be completed. -10814

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

 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 下载的最新SDK v4.26.0我跟着link为 FB 安装的步骤。我的代码是

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 并且我得到错误作为

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

因此在我的模拟器或设备中不包含 facebook 系统设置中的帐户设置。然后它出现在下面的 block 上

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

如果我打印错误,

No Facebook account. There are no Facebook accounts configured. You can add or create a Facebook account in Settings.

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

关于ios - -canOpenURL : failed for URL: "fbauth2:/" (OSStatus error -10814. )”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46319937/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com