Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook iOS8 SDK build module error for FBSDKCoreKit

I am trying to add the Facebook SDK to my iOS 8 Objective-C app in Xcode. I did the install according to the FB-dev instructions. However, I get a "Could not build module 'FBSDKCoreKit'" error when I add the header to my AppDelegate.m file.

#import "AppDelegate.h"
#import <FBSDKCoreKit/FBSDKCoreKit.h>

Based on what I read elsewhere

  1. I have already cleaned the build and re-installed Xcode.
  2. I also re-installed the Facebook SDK installer and tried to add it to a blank project (in case there was something corrupt with my app).
  3. I have double checked the plist and the framework files FB lists in the instructions, but nothing has seemed missing.

I'm stumped.

like image 943
star7anne Avatar asked Apr 03 '15 15:04

star7anne


4 Answers

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...

like image 129
abjurato Avatar answered Nov 15 '22 20:11

abjurato


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.

like image 27
vlad Avatar answered Nov 15 '22 18:11

vlad


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

enter image description here

like image 14
Randika Vishman Avatar answered Nov 15 '22 20:11

Randika Vishman


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

like image 11
Daniil Bystrov Avatar answered Nov 15 '22 19:11

Daniil Bystrov