6

Here in this change-log(facebook change-log) it is stated that there is no need for objective-c bridging headers for swift.

But when I import FBSDKCoreKit in AppDelegate.swift these errors occur:

FBSDKAppLinkResolver.h

/Users/[username]/Documents/FacebookSDK/FBSDKCoreKit.framework/Headers/FBSDKAppLinkResolver.h:21:9: Include of non-modular header inside framework module 'FBSDKCoreKit.FBSDKAppLinkResolver'

AppDelegate.swift

/Users/ashrafkholeif/Projects/xcode/TabbedApplicationTemplate/TabbedApplicationTemplate/TabbedApplicationTemplate/AppDelegate.swift:10:8: Could not build Objective-C module 'FBSDKCoreKit'

edit: I even set the allow non-modular header inside framework modules to YES.

Community
  • 1
  • 1

4 Answers4

7

I had the exact same issue, the solution suggested on https://stackoverflow.com/a/29457503/425682 for an Objective-C project worked straight away on my Swift project:

Write a new file in the Facebook SDK folder under Bolts.framework/Modules/module.modulemap with the following content:

framework module Bolts {
umbrella header "Bolts.h"

export *
module * { export * }


explicit module BFAppLinkResolver {
    header "BFAppLinkResolver.h"
    link "BFAppLinkResolver"
    export *
}}

This works without bridging headers (not needed anymore in version 4.0.1 of the SDK as mentioned by the OP), and without changes to the build settings.

EDIT: this bug is now fixed as of version 4.1 of the Facebook SDK, the library works without having to do any change.

Community
  • 1
  • 1
ahelix
  • 308
  • 1
  • 2
  • 13
  • This is great! The best solution so far :) Deleting modules seemed clunky, and messing with clang options did not work. – Géal Apr 22 '15 at 13:31
2

This is a bug and Facebook is currently "assigning this to the appropriate team".

To get updates to this issue follow this link:

https://developers.facebook.com/bugs/362995353893156/

and hit subscribe.

Hopefully it doesn't take them too long to fix.

Also here is a related question recently posted on SO:

issue using FBSDK in swift iOS application

And some people have found success using the answers on this link (none have worked for me):

Facebook iOS8 SDK build module error for FBSDKCoreKit

Community
  • 1
  • 1
Paul Lehn
  • 3,202
  • 1
  • 24
  • 29
2

The fix that worked for me:

rm -r ~/Documents/FacebookSDK/FBSDKCoreKit.framework/Modules/

Repeat with other frameworks.

Source: https://developers.facebook.com/docs/ios/troubleshooting#xcode_link

charlax
  • 25,125
  • 19
  • 60
  • 71
1

Create a new header file and import any objective-c code you are using, something like this..

#ifndef RJv1_RJBridge_h
#define RJv1_RJBridge_h
#import "NSMutableString+Obfuscated.h"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#endif

Then go to your Build Settings, look for Install Objective-C Compability Header, and make sure is set to Yes, then add a relative path to your header file in the field Objective-C Bridging Header.

Hope it works!