'Unknown type name FBSDK_EXTERN' Build Error resulting from use of CocoaPods and use_frameworks

Viewed 1791

I am trying to upgrade my iOS app with the latest FacebookSDK. Facebook recommends the use of CocoaPods for upgrades. I was already using another 3rd party SDK that also uses CocoaPods. For the existing 3rd party SDK, it requires the use of use_frameworks! in the podFile. However, when I run 'pod update' and then build my app, I get the following errors:

Unknown type name FBSDK_EXTERN [facebook header file]

for each Facebook header file that uses this extern. How can I resolve this apparent incompatibility between podFile requirements of these two different SDKs?

My podFile looks like the following:

 platform :ios, '8.0'

 def shared_pod
   use_frameworks!

   pod 'apptentive-ios', '~> 4'
   pod 'FacebookSDK'

 end

 target 'myApp' do
   shared_pod
 end

 target 'myOtherApp' do
   shared_pod
 end

Alternatively, how can I resolve the 'Unknown type name FBSDK_EXTERN' to allow my app to build?

3 Answers

I also had the same problem.

I believe this can be cause by CocoaPods cache.

The best approach (and worked for me) is

  • go to the /Pods folder
  • delete the problematic framework folder (may be named FBSDKLoginKit)
  • run pod install --repo-update again

if that doesn't work try resolving your pod to the previous version pod 'FacebookSDK', '4.37.0'

Cheers

Had the same error when tried to compile FBSDKShareKit 4.38.1 with FacebookSDK 4.37.0. Updating FacebookSDK to 4.38.0 fixed this issue.

I tried Francisco's solution without success, downgraded to 4.37.0 and suddenly still got the same error (even though I had this version installed right before trying to update).

What then helped was simply cleaning Xcode's build folder, building now works for me.

Related