FBSDKShareKit.h file cannot be located

Feedback

Question:

To integrate
integrate facebook
into my app via CocoaPods, I’ve employed the use_frameworks! tag and added the bolts pod based on Facebook’s instructions. However, when I attempt to utilize

import FBSDKCoreKit

in my appdelegate, I encounter an error indicating that there is no such module as
fbsdkcorekit
. The podfile I’ve used is presented below:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.2'
use_frameworks!
pod 'Bolts'
pod 'Alamofire', '~> 3.0'
pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'

Bolts, FBSDKCoreKit, and
fbsdksharekit
in my Pods folder have a
question mark
beside them, whereas alamofire, which I previously used, has no such tag. In the Frameworks folder of my Pods project, FBSDKCoreKit and Bolts are present but appear in red. Despite cleaning my project and reinstalling and updating the pods, I am still unsure what the issue may be. Any suggestions?


Solution 1:

When transitioning from

Carthage

to

Cocoapods

, it is important to eliminate any Carthage mentions related to

FBSDKCoreKit

in the

Link Binary With Libraries

located within the

Build Phases

setting.


Solution 2:

Please try below steps,

  • Specify the particular editions, that is.

pod ‘FBSDKCoreKit’, ‘~>5.8.0’

pod ‘FBSDKShareKit’, ‘~>5.8.0’

pod ‘
fbsdkloginkit
‘, ‘~>5.8.0’

  • Utilize

    sudo pod repo update

    to refresh the pod repository.
  • Update pod using

    pod update


Solution 3:


It appears that the Facebook pods are written in Objective-C, which requires a unique method for integration into a Swift project.

This is how I got it to work:

To add a
bridging Header
to your project, you can create a new header file such as

Bridging-Header.h

and set it as the
bridging header
in the project settings. Refer to the screenshot below for guidance.

In this file, you can import the necessary Facebook modules. Take a look at my file’s structure:

#ifndef Bridging_Header_h
#define Bridging_Header_h
@import FBSDKCoreKit;
@import FBSDKLoginKit;
#endif /* Bridging_Header_h */

Please inform me if this exercise is effective for you or if you require further assistance.


Solution 4:

I fixed this by

  1. Eliminating the Bridging Header is unnecessary as the Facebook SDK no longer requires it beyond version 4.1.
  2. Incorporating the collection of .frameworks into the
    Projects Build
    stages through the process of linking binaries with libraries.
  3. To build each framework, simply select your project name located next to the run arrow.
  4. Performing a system cleanup and rebooting my device.

Frequently Asked Questions