facebookios5facebook-ios-sdk

Including deprecated Facebook header folder gives error


I am using this link. But I am really stuck here, and i am getting 20 errors of duplicity and redefinition.

It happens when I replaced facebookSDK/FacebookSDK.h to Facebook.h . Before that as said in the tutorial I include a folder "Deprecated header" from Facebook sdk.

According to this Facebook tutorial:

Step 2: Sending the request

To invoke the Facebook dialogs you must reference the Facebook deprecated headers. The headers can be found here ~Documents/FacebookSDK/FacebookSDK.framework/Versions/A/DeprecatedHeaders. Drag the whole DeprecatedHeaders folder and deselect the "Copy items into destination group's folder (if needed)" option to add the headers as a reference.

Now you can make the required code changes. In your app delegate import the Facebook.h header file and replace the Facebook framework <FacebookSDK/FacebookSDK.h> import declaration:

#import "Facebook.h"

This will allow you to make call to the FBDialog classes. The Facebook.h header includes the <FacebookSDK/FacebookSDK.h> header files. If you have any problems with Xcode recognizing the Facebook.h file just close and reopen your Xcode project.

In the app delegate header file, declare a property that will hold the Facebook instance:

@property (strong, nonatomic) Facebook *facebook;

In the app delegate implementation file, synthesize the Facebook property:

@synthesize facebook = _facebook;

As soon as I do this, I get errors and not able to compile.


Solution

  • solved it finally.

    I removed errors using following steps:

    i replaced #import "FacebookSDK/FacebookSDK.h" with #import "FBSession.h" everywhere in my project. And other thing i Only used #import "facebook.h " in Appdelegate.h. This solved the error for me and i did nothing extra

    Hope this would help someone here