Basic Swift 2 application using the Facebook 4.8 SDK
###Follow the Facebook Quick Start.
- Don't forget to import the frameworks and select "Copy items if needed" in the Options.
- Copy the settings from the Facebook Quick Start into your applications's plist file.
- In ViewController.swift file
import FBSDKLoginKit
and add the following code to the viewDidLoad method:
let loginButton = FBSDKLoginButton.init()
loginButton.center = self.view.center
self.view.addSubview(loginButton)
- In AppDelegate.swift
import FBSDKShareKit
and add the following method:
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(
application,
openURL: url,
sourceApplication: sourceApplication,
annotation: annotation)
}