CocoaPods / CocoaPods

The Cocoa Dependency Manager.
https://cocoapods.org/
Other
14.55k stars 2.63k forks source link

Using FBSDKCoreKit as a dependency in conjunction with use_frameworks causes build errors #3816

Closed fleshgolem closed 9 years ago

fleshgolem commented 9 years ago

There seem to be some problems occuring, when using the new facebook-ios-sdk as a dependency in a pod and then including said Pod with with use_frameworks!

Example podspec:

Pod::Spec.new do |s|
  #Metadata omitted
  s.source       = { :git => "https://github.com/fleshgolem/TestPod.git", :tag => "0.0.1" }
  s.source_files  = "TestPod/TestClass.swift"

  s.dependency "FBSDKCoreKit", "~> 4.4"
  s.dependency "FBSDKLoginKit", "~> 4.4"
  s.dependency "FBSDKShareKit", "~> 4.4"

end

Example Podfile:

use_frameworks!
target 'TestProject' do

    pod 'TestPod', :path => "../TestPod/TestPod.podspec"

end

This will build fine once. But after cleaning the Project and building again it will throw a "Include of non-modular header inside framework module"-Error in FBSDKAppLinkResolver.h

screenshot_27

I found some issues with the facebook SDK but allegedly those have been resolved after version 4.0. So I'm left quite clueless now. I am also not sure if this problem even concerns CocoaPods at all or if it needs fixing from facebook. I would appreciate any help regarding this

neonichu commented 9 years ago

This looks like a problem with the FB SDK itself to me.

Rawrcoon commented 9 years ago

Link to the Facebook bug report: https://developers.facebook.com/bugs/850078471740674/?search_id

fatuhoku commented 9 years ago

+1 getting the same issue.

LightD commented 9 years ago

grrrrr.. so is there a temporary workaround for this thing? can't even open an issue on their github.........

neonichu commented 9 years ago

Seems like FB could reproduce the issue with @Rawrcoon's bug report, so it's wait and see. Nothing we can do from the CocoaPods side at the moment.

Rawrcoon commented 9 years ago

Adding Bolts as an explicit dependency in the podspec did resolve the issue. Strangely the Bolts dependency must be BEFORE the dependencies on FBSDK in order to work properly.

Further explanation was provided by the Facebook team at the bug report thread i posted earlier.

LightD commented 9 years ago

That's great, thanks for the update @Rawrcoon!

Rawrcoon commented 9 years ago

If you are still getting errors after the dependency workaround, try to import Bolts ABOVE (important!) the FBSDKCoreKit

import Bolts
import FBSDKCoreKit
LightD commented 9 years ago

wow, that made no sense, but you have literally saved me.. thnx a lot man :grin:

hzalaz commented 9 years ago

@Rawrcoon it's doesn't work for me including Bolts. You have the flag CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES set to YES?

Rawrcoon commented 9 years ago

Yes, CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES is set to YES.

If you do have the explicit dependency and import Bolts above FBSDKCoreKit, my guess is that you have a different problem.

hzalaz commented 9 years ago

@Rawrcoon that's what I was missing, thought importing Bolts alone was sufficient. Thanks!