I'm trying to integrate a facebook login, well:
I downloaded the FacebookSDKs-iOS-4.18.0 2 from the developer facebook site.
After that, I added the next xml in my info.plist file:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb21200000000000</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>21200000000000</string>
<key>FacebookDisplayName</key>
<string>San Miguel Digital</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
<key>NSPhotoLibraryUsageDescription</key>
<string>{human-readable reason for photo access}</string>
AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
}
LoginViewController.swift
import Foundation
import UIKit
//import FacebookCore
//import FacebookLogin
import FBSDKCoreKit
import FBSDKLoginKit
class LoginViewController: UIViewController, FBSDKLoginButtonDelegate {
override func viewDidLoad(){
super.viewDidLoad()
/*let loginButton = LoginButton(readPermissions: [ .publicProfile, .email ])
loginButton.center = view.center
view.addSubview(loginButton)*/
if(FBSDKAccessToken.current() == nil){
print("Is not logged in")
}else{
print("Currently is logged in")
}
let loginButton = FBSDKLoginButton()
loginButton.readPermissions = ["public_profile", "email"]
loginButton.center = self.view.center
loginButton.delegate = self
self.view.addSubview(loginButton)
}
func loginButtonDidLogOut(_ loginButton: FBSDKLoginButton!) {
print("Logged out")
}
func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
if(error == nil){
print("Successfully logged")
}else{
print(error.localizedDescription)
}
}
}
The facebook login button appears when I execute the application on the iphone device, but in the log error, I get:
Is not logged in libc++abi.dylib: terminating with uncaught exception of type NSException warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.
What I'm doing wrong?