Parse and Facebook SDK imports conflict in Xcode 6

2019-09-10 10:58发布

问题:

When I try to import the ParseFacebookUtils framework in Swift, it does not work. In the documentation https://parse.com/docs/ios/guide#users-facebook-sdk-and-parse I follow the steps to integrate the FBSDK (once I have Parse up and running, error-free).

The thing is that since the Parse.com iOS SDK was just recently updated (you dont really have to create bridging headers anymore for the Parse SDK Frameworks), and in the link above they tell you to include:

#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <ParseFacebookUtilsV4/PFFacebookUtils.h>

in your header file. I tried both to import the ParseFacebookUtils with a regular import in swift, but the compiler complains and says:

(This is my AppDelegate.swift file)


Then I tried my luck and went ahead and import everything normally as in the image above, but then creating a bridging header just to import ParseFacebookUtils, like so:

But it did not work. Even if I comment out the ParseFacebookUtils in swift.

Can you help me solving this issue?

Thank you so much for your help in advance!

Cheers!

回答1:

In my AppDelegate, I didn't have to import ParseFacebookUtils, just UIKit, Parse, FBSDKCoreKit, and FBSDKLoginKit (I also added Bolts to be safe but it didn't make a difference). My bridging header also includes "#import " Have you tried deleting the other PFFacebookUtils Framework that isn't V4? My Parse frameworks came with PFFacebookUtils.Framework and PFFacebookUtilsV4.Framework and deleting the older one got rid of my compiling errors, although my app still has its own login issue at runtime that you hopefully won't have. Hope that solves your problem!



回答2:

Because Armin's answer didn't work for me, what I have done is the following:

  • I created a bridge file (to be able to import Objective - C code in Swift).
  • I removed the ParseFacebookUtils.framework. (I don't know if it is necessary).
  • I wrote the following: #import <ParseFacebookUtilsV4/PFFacebookUtils.h>.

After that I was able to use PFFacebookUtils!



回答3:

Try change to

import ParseFacebookUtilsV4

and remove reference ParseFacebookUtils Because is not working with Parse sdk 4+