Reputation: 1892
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.
Upvotes: 4
Views: 4944
Reputation: 125
Try this:
import Bolts
import ParseFacebookUtilsV4
import FBSDKCoreKit
import FBSDKLoginKit
Upvotes: 11
Reputation: 161
This happened to me when I enabled frameworks in cocoapods (use_frameworks!) -- once I added "import ParseFacebookUtilsV4" Xcode was able to find PFFacebookUtils.
Upvotes: 3
Reputation: 838
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.
Upvotes: 8
Reputation: 62072
Make sure you've set your bridging header correctly.
If you click your project in the "Project Navigator", then click your target, click Build Settings, and scroll down to "Swift Compiler - Code Generation", you should see a row for Objective-C Briding Header.
In this row, you need to enter your bridging header:
ProjectName/Your-Bridging-Header.h
Upvotes: 3