ios - -canOpenURL : failed for URL: "fbauth2:/" - error: "The operation couldn’ t be completed.(OSStatus 错误 -10814。)

标签 ios

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

-canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)" Falling back to storing access token in NSUserDefaults because of simulator bug

这是我的appDelegate

import UIKit
import FBSDKCoreKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.

        UIApplication.shared.statusBarStyle = .lightContent

        UINavigationBar.appearance().barTintColor = UIColor(red: 0.19, green: 0.18, blue: 0.31, alpha: 1.0)
        UINavigationBar.appearance().tintColor = UIColor.white
        UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.white]


        return FBSDKApplicationDelegate.sharedInstance().application(
            application,
            didFinishLaunchingWithOptions: launchOptions
        )
    }
    func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {

        return FBSDKApplicationDelegate.sharedInstance().application(
            app,
            open: url,
            sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String,
            annotation: nil
        )
    }

    func applicationWillResignActive(_ application: UIApplication) {

    }

    func applicationDidEnterBackground(_ application: UIApplication) {

    }

    func applicationWillEnterForeground(_ application: UIApplication) {

    }

    func applicationDidBecomeActive(_ application: UIApplication) {

        FBSDKAppEvents.activateApp()
    }

    func applicationWillTerminate(_ application: UIApplication) {
    }
}

这是我的信息.plsit

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb1835000000000000</string>
            </array>
        </dict>
    </array>
    <key>FacebookAppID</key>
    <string>1835000000000000</string>
    <key>FacebookDisplayName</key>
    <string>FoodTasker</string>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbapi</string>
        <string>fb-messenger-share-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
    </array>
    <key>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
</dict>
</plist>
  • SDK v4.34.0
  • iOS SDK 10.2

最佳答案

现在我使用了最新的 pod 版本,并按照以下步骤操作 1)在pod文件中添加注释代码,如下代码

pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'

2) 打开终端并进入项目目录然后运行下面的命令

pod install
above code will removed Facebook SDK from project

3) 取消注释第 1 步代码,然后重新安装 facebook 库。它将安装最新的 veriosn facebook SDK 并尝试再次运行。问题将得到解决:)

谢谢

关于ios - -canOpenURL : failed for URL: "fbauth2:/" - error: "The operation couldn’ t be completed.(OSStatus 错误 -10814。),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52190719/

相关文章:

ios - 在 XCTest 中使用时,核心数据存储库为空

ios - 重用我为非常相似但不相同的情况创建的 UIViewController 子类 : recommended?

ios - objective c 父类(super class)中的 protected 变量在 swift 子类中不可访问

ios - 为文本字段创建观察者以启用/禁用按钮时出错(Swift 3、Xcode 8.x)

javascript - 隐藏以前的选项卡和标题 react-navigation v3

iOS11 用户位置不显示蓝色标记

Javascript 请求到 iOS Swift 请求

ios - 如何快速将 Carbon Kit 添加到我的项目中?

ios - ios中如何将数据解析成Json格式?

iphone - 只有 armv7 没有 armv6 选项