因此,使用更新的Facebook SDK以使用户能够登录我的应用程序,我似乎无法让它正常工作!我正在使用基于Firebase指南的代码,因为我正在尝试将其与之集成。
我对此感到沮丧,并且无法通过以下错误停止终止我的应用。我输入了所有正确的.plist信息,我安装了可可豆荚,以及所需的所有SDK文件夹。请帮助!
我的代码没有显示错误,但是当我构建并运行然后单击Facebook按钮时,我得到:" libc ++ abi.dylib:以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)")
}
}
}
}
这是我的Crashlog:
2016-04-03 18:24:14.425 ABH5[23068:3428052] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key fbButtonPressed.' *** First throw call stack: ( 0 CoreFoundation 0x000000010444cd85 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x00000001068f0deb objc_exception_throw + 48 2 CoreFoundation 0x000000010444c9c9 -[NSException raise] + 9 3 Foundation 0x0000000104ee619b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288 4 UIKit 0x00000001054cfd0c -[UIViewController setValue:forKey:] + 88 5 UIKit 0x00000001057067fb -[UIRuntimeOutletConnection connect] + 109 6 CoreFoundation 0x0000000104386890 -[NSArray makeObjectsPerformSelector:] + 224 7 UIKit 0x00000001057051de -[UINib instantiateWithOwner:options:] + 1864 8 UIKit 0x00000001054d68d6 -[UIViewController _loadViewFromNibNamed:bundle:] + 381 9 UIKit 0x00000001054d7202 -[UIViewController loadView] + 178 10 UIKit 0x00000001054d7560 -[UIViewController loadViewIfRequired] + 138 11 UIKit 0x00000001054d7cd3 -[UIViewController view] + 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 workspaceDidEndTransaction:] + 188 18 FrontBoardServices 0x0000000108b758c8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24 19 FrontBoardServices 0x0000000108b75741 -[FBSSerialQueue _performNext] + 178 20 FrontBoardServices 0x0000000108b75aca -[FBSSerialQueue _performNextFromRunLoopSource] + 45 21 CoreFoundation 0x0000000104372301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 22 CoreFoundation 0x000000010436822c __CFRunLoopDoSources0 + 556 23 CoreFoundation 0x00000001043676e3 __CFRunLoopRun + 867 24 CoreFoundation 0x00000001043670f8 CFRunLoopRunSpecific + 488 25 UIKit 0x0000000105337f21 -[UIApplication _run] + 402 26 UIKit 0x000000010533cf09 UIApplicationMain + 171 27 ABH5 0x00000001036a7dd2 main + 114 28 libdyld.dylib 0x00000001073b492d start + 1 29 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)