sekaisan
sekaisan

Reputation: 441

No such module 'FBSDKCoreKit' XCODE 7.4

I am trying to add the Facebook login feature using FBSDKCoreKit and FBSDKLogin. When I try to import these two framework to my AppDelegate file, it shows error which is

"No such module 'FBSDKCoreKit'".

I changed Allow Non-modular Includes In Framework Modules from NO to YES, but the error is still there.

I need help with coming up with a solution to resolve the error.

Upvotes: 10

Views: 26456

Answers (12)

Mandeep Singh
Mandeep Singh

Reputation: 905

Please try opening the project using .xcworkspce not with .xcodeproj As workspace load all the depencies.

Upvotes: 3

Priyanka
Priyanka

Reputation: 169

if you are using pods then just delete all pod file and related folders and start from the first step

init pod.

then open that pod file and add following framework   

pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'

then pod install

and import it to the swift file and enjoy :)

and if you are directly add folder to your project then make sure that 'copy if needed' is marked

Upvotes: 4

Kitcc
Kitcc

Reputation: 3138

This fixed it for me: Make sure to Clean and Build your project after running the Pod Install.

From menu: Product/ clean & then build.

Upvotes: 0

AamirR
AamirR

Reputation: 12198

I resolved No such module 'FrameworkName' issue with following steps:

1) Create a group, call it Framework (optional, best practice)

2) Drag desired SDK(s) from Original SDK path to Framework, in your case FBSDKCoreKit and FBSDKLoginKit

3) When the dialog pops 'Choose options for adding these files:', choose following:

options for adding these files

Additional step for Facebook SDK version 4.0:

4) Select the target in the project editor and click Build Settings, change Framework Search Paths to: ~/Documents/FacebookSDKDirectoryName

Upvotes: 8

Ayush Dixit
Ayush Dixit

Reputation: 625

In AppDelegate import:

import FacebookCore
import FacebookLogin

and add:

func application(_ application: UIApplication, didFinishLaunchingWithOptions 
launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {        
SDKApplicationDelegate.shared.application(application, 
didFinishLaunchingWithOptions: launchOptions)

    return true
}

func application(_ app: UIApplication, open url: URL, options: 
[UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
    return SDKApplicationDelegate.shared.application(app, open: url, 
            options: options)
}

Upvotes: 0

Ayush Dixit
Ayush Dixit

Reputation: 625

Looks like you also have to add to the Bridging-Header.h file:

#import <FBSDKCoreKit/FBSDKCoreKit.h> #import <FBSDKLoginKit/FBSDKLoginKit.h>

#import <FBSDKShareKit/FBSDKShareKit.h>

The use of Bridging-Header.h is only needed when you use the Objective-C version of the framework files. However, the Swift tutorials on the Facebook site do leave out key steps for using the Swift-built framework files, specifically the AppDelegate adjustments after importing FBSDKCoreKit there.

Upvotes: 0

Fernando Rocha
Fernando Rocha

Reputation: 19

What fixed it for me was removing the pods folder and running the install command again:

rm -Rf Pods 
pod install

Upvotes: 1

Vinu David Jose
Vinu David Jose

Reputation: 2638

I have solved this problem by typing import FBSDKLoginKit Dont copy!! just write. Hope it Helps

Upvotes: 0

Jiwoo  Choi
Jiwoo Choi

Reputation: 57

I'd like to suggest one of the easiest way.

  1. put your mouse on your project ( in xcode)
  2. and right click > Add Files to...
  3. Add your framework files.
  4. you also need to change Allow Non-modular Includes In Framework Modules setting from NO to YES,

Dada! Works like a charm!

Upvotes: 2

Onur Tuna
Onur Tuna

Reputation: 1060

I have solved this problem by copying the frameworks to the application's folder. Your application does not know the path of the frameworks.

Upvotes: 0

user3288414
user3288414

Reputation: 222

I resolved this problem by adding FacebookSDK Directory path to the "Framework Search Paths"

Go to Build Settings and search for "framework search"

Upvotes: 13

Vinod Vishwanath
Vinod Vishwanath

Reputation: 5891

It's the usual suspects. Check your Frameworks folder. Check Project -> Build Phases -> Link Binary with Libraries, and make sure FBSDKCoreKit and FBSDKLoginKit are included.

If they're there, and the error still exists, tap on each framework, and make sure Target Membership is checked under File inspector.

Upvotes: 1

Related Questions