Facebook iOS8 SDK build module error for FBSDKCoreKit

淺唱寂寞╮ 提交于 2019-11-27 06:23:12

FBSDKCoreKit can't be built because of "include of non-modular header inside framework module" error in FBSDKAppLinkResolver.h header file: in #import <Bolts/BFAppLinkResolving.h> line.

The solution from Swift compiler error: "non-modular header inside framework module" (switching CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES) did't help me.

My solution:

  1. Create in Bolts.framework file module map: Modules/module.modulemap (like in FBSDKCoreKit.framework)
  2. Put such code inside

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

Interesting fact is that in FBSDKCoreKit such scheme is realized by Facebook, why didn't they apply it into Bolts...

Not sure if it has side effects but setting the "Allow Non-modular Includes in Framework modules" setting to YES in Build settings solved the problem for me. Hope it works for you too.

Just doing the following let me to build the app successfully.

In Build settings Set "Allow Non-modular Includes in Framework modules" flag to YES

And I didn't want to Set "Enable Modules" (c and Objective-C) to NO

For Objective-C I used Paul Lehn answer from: https://developers.facebook.com/bugs/362995353893156/

  1. Add the -ObjC flag to your project's Other Linker Flags build setting. (if you don't want add to project configs, for initialise buttons classes)
  2. "Allow Non-modular Includes in Framework modules" setting to YES in Build settings
  3. Set "Enable Modules" (c and Objective-C) to No

(also don't forget add frameworks, for me it was: "AdressBook" "QuartzCore" "CoreLocation" "CoreGraphics" and if still not added, also "UIKit" "Foundation" "CoreData")

and its finally worked for me

all this used for linked FBSDK in custom folder in my project folder not from ~/Documents/FacebookSDK

Remove Module Directory From FacebookCoreKit.framwork.

Thuyen Trinh

From Chris Pan (Facebook Team): https://developers.facebook.com/bugs/362995353893156/

The 4.0.1 release added module maps (which should have obviated the need for bridging headers) but it looks like that may have caused some other compatibility issues. We're working on a proper fix but another workaround is to remove the module maps manually from each of the FBSDK*Kit.framework bundles; e.g., rm -r ~/Documents/FacebookSDK/FBSDKCoreKit.framework/Modules/ (and repeat for FBSDKLoginKit and FBSDKShareKit)

As far as I know, we have 2 options to deal with this problem:

  1. Remove all module maps as Chris said.
  2. Add a temporary (unofficial) missing module map file in Bolts.framework folder (in FacebookSDK folder). You should check if this folder is missing or not.

If you are having issue with 'FBSDKCoreKit' You can try below solutions:

  1. Goto Build Setting and search for "allow non-modular" and Set

    "Allow Non-modular Includes in Framework modules" flag to YES

  1. Go to Document/FacebookSDK folder

    then goto FBSDKCoreKit.framework

    In this folder Remove Modules folder. Then add the FacebookSDK library in your project.

  2. Set the Framework search path to "~/Documents/FacebookSDK"

    Steps to find Framework search Path

    Goto build setting of the project and search for "framework search path".

    Then add "~/Documents/FacebookSDK"

Edit:

please open the Framework search path in Facebook app and copy paste all the paths mentioned over there in your application.Similar to the path i have attached in below screen shots

This will fix your problem

Got this issue too, you need to set

Enable Modules (C and Objective-C)

to NO.

I have faced the same problem. The issue was that my project directory contained space in the name "Application Demo". That's why whenever I dragg the Facebook frameworks then it added space in Framework Search Paths in settings. Remove this space resolved the issue.

TL;DR Remove your Bolts.framework reference in your project.

None of these or any of the other answers worked for me (in my case). For my project we were switching from an older Facebook sdk and we had a Bolts.framework.

Reading the documentation

The SDK automatically loads its framework and resource dependencies.

As such I think there is a collision going on. There was the Bolts.framework I had from before and then the new one that came when I downloaded the new FacebookSDK bundle (4.7 in this case).

Removing my Bolts.framework fixes the problem (be sure to clean before rebuilding).

You're probably importing the "Samples" folder that comes with Facebook's SDK into your project. Remove the references to those files from your project and it should work. No need to change flags on your build settings.

I should direct you to this current open issue assigned to Facebook: https://developers.facebook.com/bugs/362995353893156/. None of the answers here helped me, so I assume we just sit ducks:

As at time of writing, a message from Facebooks Chris Pan:

"The 4.0.1 release added module maps (which should have obviated the need for bridging headers) but it looks like that may have caused some other compatibility issues. We're working on a proper fix but another workaround is to remove the module maps manually from each of the FBSDK*Kit.framework bundles; e.g., rm -r ~/Documents/FacebookSDK/FBSDKCoreKit.framework/Modules/ (and repeat for FBSDKLoginKit and FBSDKShareKit)"

Kosala Ubayasekara got it to work, but since this is an open issue you might want to simply wait until an official fix is clear:

  1. In Build Settings under Apple LLVM Modules:

    1. Set Allow Non-modular Includes in Framework modules" setting to NO
    2. Enable Modules (C and Objective C) to NO.
  2. Create a bridging header to include the Facebook SDK headers

  3. Link bridging header in Build Settings : Swift Compiler - Code Generation.
  4. Import FBSDKCoreKit into your App Delegate file and implement the core Facebook SDK requirements as per the FB documentation

Same issue was with me. ... Non of the above solution works for me.. I set . modules, flags and other things also... but nothing help to it.

But for me this issue is solved by

MOVE your framework folder AFTER or WITHIN the folder where .pch file is located at.

When my framework folder @ myapp/{frameworkFolder}/fbframeworks.
It was showing issues.

I move it to myapp/myapp/modal/{fbframework}/. Then this issue was solved. (my .pch file is located at myapp/myapp.)

May be the same can help to anyone having same issue.

I got the same problem, I was using the newest Facebook SDK (FacebookSDKs-iOS-20160316) on Xcode 6.4, it consistently gives me this error whenever I put the following code in my AppDelegate.m file: #import <FBSDKCoreKit/FBSDKCoreKit.h>

When I switched to Xcode 7.2, problem solved, the error is gone. Guess this maybe the version compatible issue

If you are facing the same issue with me, you can have a try to use Xcode 7.2 to build it. Problem is Xcod 6.4 may never be able to used as long as you keep the Facebook sdk in your project.

Hope this helps!

For those who came here and made the same rookie mistake like I did. Maybe I can save you some time. I work on an old project which largely consists of Objective-C code. We try to implement new stuff in Swift.

This was what i tried in my Swift code

import FBSDKCoreKit

class SomeClass {

  func doSomething {
    FBSDKAppEvents.logEvent("Some Event")
  }
}

But the compiler complained that it could not compile the module, etc.

How I solved it

  • Remove the import FBSDKCoreKit from my Swift code.
  • Edited our Bridging-Header.h and imported FBSDKCoreKit there: #import <FBSDKCoreKit/FBSDKCoreKit.h>

Make sure you've also imported the Bolts framework, this worked for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!