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.
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.
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
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
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With