1

因此,使用更新的 Facebook SDK 使用户能够登录到我的应用程序,我似乎无法让它正常工作!我正在使用基于 Firebase 指南的代码,因为这是我试图与之集成的代码。

我对此感到沮丧,无法得到以下错误来停止终止我的应用程序。我输入了所有正确的 .plist 信息,安装了可可豆荚,以及所有必需的 SDK 文件夹。请帮忙!

我的代码没有显示任何错误,但是当我构建并运行然后单击 Facebook 按钮时,我得到:“libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)”

这是我的代码:

import UIKit
import FBSDKCoreKit
import FBSDKLoginKit


class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}


@IBAction func fbButtonPressed(sender: UIButton!) {

    let facebookLogin = FBSDKLoginManager()

        facebookLogin.logInWithReadPermissions(["email"], fromViewController: self) { (facebookResult: FBSDKLoginManagerLoginResult!, facebookError: NSError!) -> Void in

        if facebookError != nil{
            print("Facebook login failed. Error\(facebookError)")
        } else {
            let accessToken = FBSDKAccessToken.currentAccessToken().tokenString
            print("Succesfully logged in with Facebook. \(accessToken)")
        }
    }
}
}

这是我的崩溃日志:

2016-04-03 18:24:14.425 ABH5[23068:3428052] *** 由于未捕获的异常“NSUnknownKeyException”而终止应用程序,原因:“[setValue:forUndefinedKey:]:此类不符合键值编码键 fbButtonPressed。
*** 首先抛出调用堆栈:
(
    0 核心基础 0x000000010444cd85 __exceptionPreprocess + 165
    1 libobjc.A.dylib 0x00000001068f0deb objc_exception_throw + 48
    2 核心基础 0x000000010444c9c9 -[NSException raise] + 9
    3 基础 0x0000000104ee619b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
    4 UIKit 0x00000001054cfd0c-[UIViewController setValue:forKey:] + 88
    5 UIKit 0x00000001057067fb-[UIRuntimeOutletConnection 连接] + 109
    6 核心基础 0x0000000104386890 -[NSArray makeObjectsPerformSelector:] + 224
    7 UIKit 0x00000001057051de-[UINib 实例化WithOwner:选项:] + 1864
    8 UIKit 0x00000001054d68d6-[UIViewController _loadViewFromNibNamed:bundle:] + 381
    9 UIKit 0x00000001054d7202-[UIViewController loadView] + 178
    10 UIKit 0x00000001054d7560-[UIViewController loadViewIfRequired] + 138
    11 UIKit 0x00000001054d7cd3 -[UIViewController 视图] + 27
    12 UIKit 0x00000001053adfb4-[UIWindow addRootViewControllerViewIfPossible] + 61
    13 UIKit 0x00000001053ae69d-[UIWindow _setHidden:forced:] + 282
    14 UIKit 0x00000001053c0180 -[UIWindow makeKeyAndVisible] + 42
    15 UIKit 0x0000000105334ed9-[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
    16 UIKit 0x000000010533b568-[UIApplication_runWithMainScene:transitionContext:completion:] + 1769
    17 UIKit 0x0000000105338714-[UIApplication 工作区DidEndTransaction:] + 188
    18 前板服务 0x0000000108b758c8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
    19 前板服务 0x0000000108b75741 -[FBSSerialQueue _performNext] + 178
    20 前板服务 0x0000000108b75aca -[FBSSerialQueue _performNextFromRunLoopSource] + 45
    21 核心基础 0x0000000104372301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    22 核心基础 0x000000010436822c __CFRunLoopDoSources0 + 556
    23 核心基础 0x00000001043676e3 __CFRunLoopRun + 867
    24 核心基础 0x00000001043670f8 CFRunLoopRunSpecific + 488
    25 UIKit 0x0000000105337f21-[UIApplication_run] + 402
    26 UIKit 0x000000010533cf09 UIApplicationMain + 171
    27 ABH5 0x00000001036a7dd2 主 + 114
    28 libdyld.dylib 0x00000001073b492d 开始 + 1
    29 ???0x0000000000000001 0x0 + 1
)
libc++abi.dylib:以 NSException 类型的未捕获异常终止
(lldb)
4

0 回答 0