-
-
Save iaserrat/4765b0f3532dfe87986e to your computer and use it in GitHub Desktop.
| // YourProject-Bridging-Header.h | |
| #import <FacebookSDK/FacebookSDK.h> | |
| // AppDelegate.swift | |
| import UIKit | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| . | |
| . | |
| . | |
| func application(application: UIApplication, openURL url: NSURL, sourceApplication: NSString?, annotation: AnyObject) -> Bool { | |
| var wasHandled:Bool = FBAppCall.handleOpenURL(url, sourceApplication: sourceApplication) | |
| return wasHandled | |
| } | |
| } | |
| // ViewController.swift | |
| import Foundation | |
| import UIKit | |
| class LoginViewController: UIViewController, FBLoginViewDelegate { | |
| var fbl: FBLoginView = FBLoginView() | |
| @IBOutlet var loginView : FBLoginView | |
| @IBOutlet var profilePictureView : FBProfilePictureView | |
| @IBOutlet var userNameTxt : UILabel | |
| @IBOutlet var logStatusTxt : UILabel | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| fbl.delegate = self | |
| loginView.readPermissions = ["public_profile", "email", "user_friends"] | |
| // 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. | |
| } | |
| func loginViewShowingLoggedInUser(loginView: FBLoginView) { | |
| logStatusTxt.text = "You are logged in!" | |
| } | |
| func loginViewFetchedUserInfo(loginView: FBLoginView?, user: FBGraphUser) { | |
| profilePictureView.profileID = user.objectID | |
| userNameTxt.text = user.first_name + " " + user.last_name | |
| } | |
| func loginViewShowingLoggedOutUser(loginView: FBLoginView?) { | |
| profilePictureView.profileID = nil | |
| userNameTxt.text = "" | |
| logStatusTxt.text = "You are logged out!" | |
| } | |
| } |
@pocketkk Exact issue here. I've already submitted a bug report to apple...
This guide helped me a lot. But when I want to declare the delegate of Facebook in UIViewController no longer compiles and Xcode (beta 3) begins to fail with the following warning: SourceKitService Terminated
It's so sad :(
Can you guys help me to test if this is working on Beta 4? I think it is.
In this code, I don't understand why you have to declare
var fbl: FBLoginView = FBLoginView()
and the
fbl.delegate = self
is then not needed.
I would have set the
loginView.delegate = self
instead
and in the AppDelegate.swift
func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
// Override point for customization after application launch.
FBLoginView.self()
return true
}
@iaserrat, checked, works in Beta4
It works on beta 4!
Same issue. Originally worked fine with beta 2, doesn't work with beta 3. Tried reopening in beta 2 and got different errors. Beta 3 must of made changes and now i can't go back :(