10

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.

whereisSQL
  • 638
  • 2
  • 13
  • 23
sekaisan
  • 441
  • 3
  • 8
  • 20
  • I had a white space in the name of the project directory, that caused my problem, need edit `Framework Search Path` in Project Setting like here: http://stackoverflow.com/a/28486611 – János May 10 '16 at 08:59

12 Answers12

13

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

Go to Build Settings and search for "framework search"

Suraj Sonawane
  • 2,044
  • 1
  • 14
  • 24
user3288414
  • 222
  • 3
  • 10
  • 7
    I was able to get this to work by downloading the FB SDK, adding it to my project manually, and adding the local file path in build settings. Do you know what path I would use if I want to include the FB Kits via cocoapods? – mkc842 Sep 28 '15 at 18:05
8

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

AamirR
  • 11,672
  • 4
  • 59
  • 73
  • If you're working with others, wouldn't they also have to have the SDK in the same directory on their local machines? (ie. ~/Documents/FacebookSDKDirectoryName). Wouldn't it just be easier to copy the SDK directly into the app folder? – SimplyLearning Oct 23 '16 at 14:31
3

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

Valentin Shamardin
  • 3,569
  • 4
  • 34
  • 51
Priyanka
  • 159
  • 2
2

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!

Jiwoo Choi
  • 57
  • 2
  • 7
2

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

Mandeep Singh
  • 857
  • 8
  • 13
  • This does not appear to answer the question. Please elaborate (if it is supposed to answer the question) or post as a comment. – Robert Jun 17 '18 at 18:00
1

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.

Vinod Vishwanath
  • 5,821
  • 2
  • 26
  • 40
  • 1
    FBSDKCoreKit and FBSDKLoginKit are included in the Link Binary with Libraries. And also Target Membership is checked for each. – sekaisan Aug 18 '15 at 18:53
0

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

Onur Tuna
  • 1,030
  • 1
  • 10
  • 28
0

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

Vinu David Jose
  • 2,569
  • 1
  • 21
  • 38
0

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

rm -Rf Pods 
pod install
0

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.

Ayush Dixit
  • 467
  • 4
  • 10
0

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)
}
Mittal Patel
  • 2,732
  • 14
  • 23
Ayush Dixit
  • 467
  • 4
  • 10
0

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

From menu: Product/ clean & then build.

Kitcc
  • 2,138
  • 4
  • 24
  • 42