Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse+Facebook SDK Issues - Use of Unresolved Identifier 'PFFacebookUtils'

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.

like image 378
justColbs Avatar asked Nov 29 '22 01:11

justColbs


2 Answers

Try this:

import Bolts
import ParseFacebookUtilsV4
import FBSDKCoreKit
import FBSDKLoginKit
like image 52
ImmaKillYa Avatar answered Dec 06 '22 12:12

ImmaKillYa


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.

like image 37
NS1518 Avatar answered Dec 06 '22 11:12

NS1518