'FBSDKCoreKit/FBSDKCoreKit.h' file not found

Hi Guys,

I’m quite stuck on an issue. I’ve found many threads with different solutions but none are working for me.

I’m building in unity on windows, then transferring the build to a mac to build to iPhone. It was all working fine until i added facebook sdk which works fine in my unity editor but the Xcode build no longer works.

I’ve tried:

  • installing the pod file that comes with the unity build (once it’s on my mac).
  • adding info.plist snippet from facebook dev portal
  • manually adding the fbsdk packages to the frameworks folders in my project
  • making sure I open the .xcworkspace file after installing pods
  • many different combinations of editing the framework search paths
    and some other suggestions I came across, but none worked

Is there something I need to do in unity before building for iOS? or any other solutions?

Many thanks, image below - this is in the FBUnityInterface.mm file:


1 Like

finally solved this after two days of searching and trying things. If you’re working on windows/unity and then transferring your build to mac/xcode to build and having this problem with facebook sdk try:

In unity:

  • Assets > Play Services Resolver > iOS Resolver Settings
  • Make sure everything is ticked, and in the dropdown select "Add cocoapods to the xcode project (important). by default its set to workspace not project (this was the issue for mine).
  • Build your project

On Mac:

  • install pod then open the “workspace” that’s generated and build from there.

hopefully this saves someone some time.

4 Likes

Xcode with Facebook and iOS working - Step By Step

After much frustration I got my Iphone game building just fine. Following a combination of Ixgee’s solution, and other solutions.

Fixes - FBSDKCoreKit.h not found and other related issues

  • I’m using Unity and Facebook SDK v11
  1. Unity → ExternalDependencyManager → IOS Resolver Settings - make it build to a Xcode project and make sure all the checkboxes are checked.

  2. MacOS → move project to Mac. In Terminal in the project directory do the ‘sudo chmod +x process_symbols.sh’

2.5 Make sure you have cocoa pods installed. In Terminal type ‘sudo gem install cocoapods’

  1. MacOS->Podfile - the pod file in your project should look like this for Facebook SDK 11
source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'

target 'UnityFramework' do
  pod 'FBSDKCoreKit', '~> 11.1.0', :modular_headers => true
  pod 'FBSDKCoreKit_Basics', '~> 11.1.0'
  pod 'FBSDKGamingServicesKit', '~> 11.1.0'
  pod 'FBSDKLoginKit', '~> 11.1.0'
  pod 'FBSDKShareKit', '~> 11.1.0'
end
target 'Unity-iPhone' do
end
use_frameworks! :linkage => :static
use_frameworks!
  1. [Only needs to be done once. If your Mac processor uses an ARM processor (like the M1)]] Terminal → Type ‘sudo arch -x86_64 gem install ffi’

Solution from - pod install has bug · Issue #10723 · CocoaPods/CocoaPods · GitHub [super helpful!]

  1. [If your Mac processor uses an ARM processor (like the M1)] Terminal → ‘arch -x86_64 pod install’

Or

[If your Mac processor uses an x86 processor (like an Intel)] Terminal → ‘pod install’

  1. Once the Pod Install is successful, double click the newly created ‘Unity-iPhone.xcworkspace’ in your project directory to open the workspace in Xcode.

  2. Xcode->The folder option → Unity-IPhone-> under Projects select ‘UnityFramework’-> select ‘Build Phases’ then drag the ‘> Headers’ above the ‘> Compile Sources’

-Full details here ( Xcode Version 13.3 (13E113) error - Cycle in dependencies )

  1. Xcode → In the Unity-phone - Build Settings → Set - ALWAYS EMBED SWIFT STANDARD LIBRARIES: YES

In the UnityFramework - Build Settings → Set - ALWAYS EMBED SWIFT STANDARD LIBRARIES: NO

Source - ios - Validation Error: Invalid Bundle. The bundle at ... contains disallowed file 'Frameworks' - Stack Overflow

  1. VOILA! It builds to your iPhone with Facebook SDK Dependencies good to go on iOS!!!

Gillissie’s Similar steps -

From - Facebook SDK build issue with FBSDKCoreKit

Update: After some fussing around, I was able to make this work. I had to do things that I’ve never had to do in the past, so I’m not sure why it’s so different now.

  1. Make sure you have cocoapods installed. At the terminal, type “sudo gem install cocoapods”

  2. Build for iOS from Unity, which creates a Unity-iPhone.xcodeproj project file and a podfile.

  3. Open podfile in a text editor, and add use_frameworks! on a line right after “target”. My podfile ended up looking like this:

target 'Unity-iPhone' do

  use_frameworks!

  pod 'FBSDKCoreKit', '~> 6.2'

  pod 'FBSDKGamingServicesKit', '~> 6.2'

  pod 'FBSDKLoginKit', '~> 6.2'

  pod 'FBSDKShareKit', '~> 6.2'

end
  1. Open terminal at the path of the xcodeproj and podfile files.

  2. In terminal, type “pod install”. This will create a Unity-iPhone.xcworkspace file.

  3. Open the workspace by double-clicking it.

  4. Set all the Unity-iPhone target settings you need in the Unity-iPhone project that’s in that workspace (such as adding frameworks, etc)

  5. Choose a device, and build.

Notes: Without the “use_frameworks!” added to the podfile, the xcworkspace will not let you see all of the Unity-iPhone project targets and schemes. I don’t understand the technical stuff about that, but that’s what I discovered.

3 Likes

For those who already have cocoapods installed, and just need to generate the .xcworkspace file:

  1. Open terminal at the build location.
  2. Ensure CocoaPods installed, by running pod --version
  3. Generate .xcworkspace file, by running pod install
  4. Build in xcode

This will download new dependencies for the Pods and generate the .xcworkspace file.