Use of unresolved identifier PFFacebookUtils

2019-02-21 18:30发布

问题:

I've done all is mentioned here (https://www.parse.com/docs/ios_guide#fbusers/iOS) for implement in iOS the Facebook Login.

The problem is that i have an compile error "Use of unresolved identifier PFFacebookUtils" near che line

PFFacebookUtils.initializeFacebook()

in AppDelegate. I've correctly imported the Parse and Facebook Framework into my project. Are there some bug knowed in Xcode 6 Beta?

回答1:

Parse docs doesn't mention this yet: After downloading the Parse iOS SDK, You should include the ParseFacebookUtils.framework into your project, then import it in each file you want to use it, like you did for the Parse.framework itself:

#import <Parse/Parse.h>// This use to be enough to use Facebook utilities
#import <ParseFacebookUtils/PFFacebookUtils.h>// But now we should import this framework as well to use Facebook utilitis

Parse team has separated the Facebook related classes from Parse API, hence a ParseFacebookUtils.framework



回答2:

You may need to

import ParseFacebookUtils

in your AppDelegate



回答3:

If you want to use PFFacebookUtils or/and PFLogInViewController with swift, you have to do this:

  1. For not V4 version: #import <ParseFacebookUtils/PFFacebookUtils.h>in bridging header and then import ParseFacebookUtils in swift file. And call PFFacebookUtils.initializeFacebook() somewhere, of course best place for this is application didFinishLaunchingWithOptions.
  2. For V4 version: #import <ParseFacebookUtilsV4/PFFacebookUtils.h> in bridging header and import ParseFacebookUtilsV4 in swift file. And call PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions) in application didFinishLaunchingWithOptions.

Of course you should have set your bridging header correctly and import frameworks.



回答4:

Resolved! #import in bridging header



回答5:

After the update to Parse/FacebookUtils, to import you do #import <Parse/PFFacebookUtils.h>