Daniel Oram
Daniel Oram

Reputation: 8411

issue using FBSDK in swift iOS application

I am coding an iOS 8 app in swift using the FBSDK to allow users to log in to my app. So far I have successfully implemented the login feature using the FBSDK v3.25 in swift using a Bridging-Header.h file and updating the info.plist accordingly to the instructions given on the FB developers website. Now I want to make an app (or update my current one) to FBSDK v4.01 but when I follow the same process of integrating it into my app I get the following errors:

-> FBSDKAppLinkResolver.h

    /Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FacebookSDK/FBSDKCoreKit.framework/Headers/FBSDKAppLinkResolver.h:21:9: Include of non-modular header inside framework module 'FBSDKCoreKit.FBSDKAppLinkResolver'

    /Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FacebookSDK/FBSDKCoreKit.framework/Headers/FBSDKAppLinkResolver.h:21:9: Include of non-modular header inside framework module 'FBSDKCoreKit.FBSDKAppLinkResolver'

-> Bridging-Header.h

    /Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FBLoginUsingSDK4/Bridging-Header.h:12:9: Could not build module 'FBSDKCoreKit'

    /Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FBLoginUsingSDK4/Bridging-Header.h:13:9: Could not build module 'FBSDKLoginKit'

    /Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FBLoginUsingSDK4/Bridging-Header.h:12:9: Could not build module 'FBSDKCoreKit'

->FBSDKLoginButton.h

    /Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FacebookSDK/FBSDKLoginKit.framework/Headers/FBSDKLoginButton.h:21:9: Could not build module 'FBSDKCoreKit'

    Failed to import bridging header '/Users/danieloram/Desktop/IOS/SWIFT/FBLoginUsingSDK4/FBLoginUsingSDK4/Bridging-Header.h'

The most obvious thing to note is the last error which says the bridging header cannot be found but it is in the same place as it was for when I was using FBSDK 3.25?

Also, all of the documentation and tutorials on the FaceBook developers website are all in obj-c so finding a solution has been a very frustrating process. Can anyone help diagnose what i am doing wrong? Any help is appreciated!

update

for the time being I have managed to compile my app by following the instructions in the Facebook developers portal and removing all modules from the FBSDK by running the following in terminal

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

this is my workaround until a proper fix is released.

Upvotes: 10

Views: 7346

Answers (3)

Ivan
Ivan

Reputation: 503

Try with build settings. Set Allow Non-modular Includes in Framework modules to YES.

Upvotes: 0

Shachar Silbert
Shachar Silbert

Reputation: 29

For those of you trying to compile a swift project with FB cocoaPods.

*BTW, it worked once, only in xCode 7.1 it stopped

Only after playing with everything, I did 2 things:

  1. Added the following code at the end of the pod:

    post_install do |installer|
    installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
        configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
    end
    

    end

  2. Remove the 'new and improved' swift imports, and add FB into the obj-C bridging header: A small screenshot of my bridging header

Upvotes: 0

Paul Lehn
Paul Lehn

Reputation: 3332

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.

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

Facebook iOS8 SDK build module error for FBSDKCoreKit

Upvotes: 3

Related Questions