I try to implement Facebook SDK in an IOS Swift project, but I can't include the SDK.
Moreover, I don't know how to translate this Objective-c snippet to Swift :-
[FBLoginView class];
Someone can help me?
The easiest way I found is to add a new "Objective-C File" into your project.
It should ask you " Would you like to configure an Objective-C bridging header? " Choose Yes .
Two files will be added to your project, the Objective-C file and " (project name)-Bridging-Header.h "
Delete the empty Objective-C file you added and open (project name)-Bridging-Header.h
Add your import for the Facebook SDK into the file (using the Objective-C style import), example:
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import <FacebookSDK/FacebookSDK.h>
Save the header file and you can now access Facebook SDK in your swift code. You do not need to add "import FacebookSDK" into your swift files. Example:
import UIKit
class LoginViewController: UIViewController {
var fbl: FBLoginView = FBLoginView()
// etc...
What are you trying to do with the class?
In swift you can reference the class with .self
like so:
FBLoginView.self
Believe with the latest updates from Facebook, the imports for the Header File are:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.