1
votes

I am integrating 3rd party libraries into my project using cocoapods. Everything was working smoothly but when i try to integrate facebook ios sdk I encounter a very strange issue, my pods project has the following warning:

Validate Project settings

If i click on it i get the following dialog:

Remove Duplicates Dialog

I checked the Headers in the build phases part of the target "Pods-Facebook-iOS-SDK". Every header file is repeating:

Repeating headers

When i try to build my project it fails because it is not able to find "FacebookSDK/FacebookSDK.h".

My last option is to just integrate facebook sdk manually and not use cocoapods for it but I dont want to take that route and for the life of me I cannot understand what I am doing wrong. For refrence following is my pod file:

platform :ios, '7.0'

pod 'DTCoreText'

pod 'UIView+AnimationExtensions'

pod 'EZAudio'

pod 'MZTimerLabel'

pod 'AWSAutoScaling'

pod 'AWSCloudWatch'

pod 'AWSCore'

pod 'AWSDynamoDB'

pod 'AWSEC2'

pod 'AWSElasticLoadBalancing'

pod 'AWSKinesis'

pod 'AWSS3'

pod 'AWSSES'

pod 'AWSSNS'

pod 'AWSSQS'

pod 'AWSSimpleDB'

pod 'Facebook-iOS-SDK'

Following is the information regarding my developement environment:

XCode: 6.1

Architectures: armv7, arm64

Base SDK: iOS 8.1

1
The FacebookSDK/FacebookSDK.h file no longer exists in v4, you should use FBSDKCoreKit/FBSDKCoreKit.h, FBSDKLoginKit/FBSDKLoginKit.h and FBSDKShareKit/FBSDKShareKit.h - Ming Li

1 Answers

3
votes

I was having a similar problem. My project previously had not used Cocoapods and I was now attempting to add the Facebook SDK via Cocapods.

Based on @MingLi's comment, I replaced all instances of #import <FacebookSDK/FacebookSDK.h> with #import <FBSDKCoreKit/FBSDKCoreKit.h> and things started working again.

When I compiled in Xcode, it showed me files that need #import <FBSDKLoginKit/FBSDKLoginKit.h> and #import <FBSDKShareKit/FBSDKShareKit.h>

You will also likely have to go through and adjust things that changed between Facebook SDK 3.x and 4.x. For instance, I had to replace [FBSettings setDefaultAppId:123456789] with [FBSDKSettings appId:123456789] and replace [FBAppEvent activateApp] with [FBSDKAppEvents activateApp].

Xcode is sometimes helpful about finding the needed change, if you compile and then click the red dot (in your code) next to each compile error.

It can take a good bit of work to sort through all of the changes, you may have to recompile many times.

If you are having problems figuring out how to replace specific functions/classes when upgrading from SDK 3.x to 4.x, you can refer to Facebook's Change Log: https://developers.facebook.com/docs/ios/change-log-4.x

You can also find additional information here: https://developers.facebook.com/docs/ios/getting-started