So with the updated Facebook SDK to enable a user to login to my app, I seem to not be able to get it to work properly! I am using code based off of Firebase's guide since that is what I am trying to integrate it with.
I am getting frustrated with it and cannot get the below error to stop terminating my app. I have all of the proper .plist info entered, I have the cocoa pods installed, and all of the SDK folders that are required. PLEASE HELP!
My code displays no errors, but when I build and run and then click on the Facebook button I get: "libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) "
Here is my code:
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)")
}
}
}
}
Here is my 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)