I understand that there have been similar posts about this issue, but nothing seems to be working.
I'm trying to enable my users to sign-up/in with Facebook, but I am having trouble getting the Facebook SDK working.
I have added the 'FBSDKCoreKit.Framework' framework as the Facebook guide says to do, as well as the 'ParseFacebookUtils.framework'. When I try and initialize facebook in my AppDelegate.swift, here..
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
Parse.setApplicationId("", clientKey: "")
PFFacebookUtils.initialize()
return true
I get the error that says "Use of unresolved identifier 'PFFacebookUtils'". I followed all the steps under 'Setup' in the Parse Docs.
This is all in Swift, and so here is my Bridging Header File...
// Use this file to import your target's public headers that you would like to expose to Swift
#import <Parse/Parse.h>
#import <ParseUI/ParseUI.h>
#import <Bolts/BFTask.h>
#import <ParseFacebookUtils/PFFacebookUtils.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
What am I doing wrong? Very frustrated, but I will eventually figure it out.
Try this:
import Bolts
import ParseFacebookUtilsV4
import FBSDKCoreKit
import FBSDKLoginKit
From what I think, you might have used ParseFacebookUtilsV4.Framework (which is the latest support for Swift I am assuming) instead of ParseFacebookUtils.Framework (old or may be the one that requires objective C bridging headed).
So if you want your app to work as per the code you have, use the ParseFacebookUtils.Framework and avoid ParseFacebookUtilsV4.Framework. But if you want to use ParseFacebookUtilsV4.Framework, you have to do some changes in your swift Appdelegate:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
}
func applicationDidBecomeActive(application: UIApplication) {
FBSDKAppEvents.activateApp()
}
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
return FBSDKApplicationDelegate.sharedInstance() .application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}
Bridging header changes:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
Not sure about the Utils import, but if needed, replace the old import code #import ParseFacebookUtils/PFFacebookUtils.h in your bridging header with this one
#import <ParseFacebookUtilsV4/PFFacebookUtils.h>
Notice the small change with addition of V4.
I hope I may have helped you in someway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With