Facebook SDK build issue with FBSDKCoreKit

Hey all,

I am having issues building my project after upgrading to Unity 2018.4.11 and the latest facebook SDK. I’ve submitted a bug report to facebook, but I’m not counting on a timely, good response. I’ve tried a few different things related to cocoapods and adding the swift package dependency, to no avail. Get Started - Facebook SDK for iOS - Documentation - Meta for Developers

So, now I turn to the Unity community. Has anyone else had to deal with this issue? The specific build error in XCode is:

ld: warning: directory not found for option '-L/Users/gillissie/Library/Developer/Xcode/DerivedData/Unity-iPhone-bujqldfjsyjydhgiestqkfocmauj/Build/Products/ReleaseForRunning-iphoneos/FBSDKCoreKit'
ld: warning: directory not found for option '-L/Users/gillissie/Library/Developer/Xcode/DerivedData/Unity-iPhone-bujqldfjsyjydhgiestqkfocmauj/Build/Products/ReleaseForRunning-iphoneos/FBSDKGamingServicesKit'
ld: warning: directory not found for option '-L/Users/gillissie/Library/Developer/Xcode/DerivedData/Unity-iPhone-bujqldfjsyjydhgiestqkfocmauj/Build/Products/ReleaseForRunning-iphoneos/FBSDKLoginKit'
ld: warning: directory not found for option '-L/Users/gillissie/Library/Developer/Xcode/DerivedData/Unity-iPhone-bujqldfjsyjydhgiestqkfocmauj/Build/Products/ReleaseForRunning-iphoneos/FBSDKShareKit'
ld: library not found for -lFBSDKCoreKit

I’m not much into setting up technical environments, so I’m kinda lost here. It’s extremely frustrating when I could build before, then upgrading things prevents moving forward. :frowning:

Thanks!

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:
use_frameworks!
pod 'FBSDKCoreKit', '~> 6.2'
pod 'FBSDKGamingServicesKit', '~> 6.2'
pod 'FBSDKLoginKit', '~> 6.2'
pod 'FBSDKShareKit', '~> 6.2'
end```
3. Open terminal at the path of the xcodeproj and podfile files.
4. In terminal, type "pod install". This will create a Unity-iPhone.xcworkspace file.
5. Open the workspace by double-clicking it.
6. Set all the Unity-iPhone target settings you need in the Unity-iPhone project that's in that workspace (such as adding frameworks, etc)
7. 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.

It’s strange, but now when I do a build, there is a xcworkspace file already there, and opening that works as needed. I have never used a workspace generated by the build process before.

OMG,I have this problem, too

It turned out that you have to open the xcworkspace file instead of the xcodeproject file. With the workspace, it also loads the required frameworks.

@Gillissie thank you! Now I need to figure out how to ENABLE_BITCODE, but at least this bug is resolved now.

Update in case anyone else follows the same rabbit hole I did: The ENABLE_BITCODE error was caused by an old libGameCenterPlugin.a file that wasn’t generating bitcode properly. It was old, and I’m not using Apple GameCenter, so I deleted it to fix the issue.

The deeper problem also seemed to be fixed by going through the Facebook SDK update process again and looking at every single thing they mention might be worth deleting before doing the update. Upgrade Guide - Unity SDK - Documentation - Meta for Developers

Since this is coming up again with a recent FB pods change:
For us (Unity 2020.3.14, FB SDK 11.0), none of the above worked since we were actually doing all of these things already, but manually updating the pods dependencies to 11.1 did result in working builds (as recommended in this thread iOS Unity Cloud builds started to fail · Issue #578 · facebook/facebook-sdk-for-unity · GitHub).

I have the same problem, but xcodeproject is not beeing generated. Any advice?

I’d guess thata if xcodeproject isn’t being generated, then your whole build isn’t succeeding for another reason.

In Unity → ExternalDependencyManager → IOS Resolver Settings - make it build to a Xcode project and make sure all the checkboxes are checked. The default is Xcode workspace, change that dropdown to Xcode project.

2 Likes

Unity Facebook SDK with IOS – Xcode working – Step by Step

Fixes - FBSDKCoreKit.h not found and other related issues

Xcode with Facebook and iOS working - Step By Step

————————————————————

  • Unity and Facebook 11 SDK
  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!!!
5 Likes

I am getting an error on xCode build :

Undefined symbol: _FBAdSettingsBridgeSetAdvertiserTrackingEnabled

The version of the pods is 14.1 :

target ‘UnityFramework’ do

pod ‘FBSDKCoreKit’, ‘~> 14.1’

pod ‘FBSDKCoreKit_Basics’, ‘~> 14.1’

pod ‘FBSDKGamingServicesKit’, ‘~> 14.1’

pod ‘FBSDKLoginKit’, ‘~> 14.1’

pod ‘FBSDKShareKit’, ‘~> 14.1’

Same issue here with Facebook SDK 15.1 :smile: :smile:
Unity 2021.3.16f1 // OS Ventura 13.2

Spent too much time yesterday trying to fix that issue…

So I finally ended up replacing this :

target ‘UnityFramework’ do
pod ‘FBSDKCoreKit’, ‘~> 15.1’
pod ‘FBSDKCoreKit_Basics’, ‘~> 15.1’
pod ‘FBSDKGamingServicesKit’, ‘~> 15.1’
pod ‘FBSDKLoginKit’, ‘~> 15.1’
pod ‘FBSDKShareKit’, ‘~> 15.1’

by this :

target ‘UnityFramework’ do
pod ‘FBSDKCoreKit’
pod ‘FBSDKCoreKit_Basics’
pod ‘FBSDKGamingServicesKit’
pod ‘FBSDKLoginKit’
pod ‘FBSDKShareKit’

Then run the pod install from the xCode project dit and it will install the previous version 14.1.0 by default :

Tried on device and it works anyway.

It seems version 15.x is mostly about refactoring for swift and other things I was concerned anyway.

There is an open ticket on github from user with the same issue related to 15.1 :

4 Likes

Just ran into this problem. It’s pretty grim!

Built ok using @sama-van 's advice there. Hope they fix soon.

For me this reply worked. Then running pod install from the project folder. This is crazy, this sdk has been round since 2012? maybe earlier and it still doesn’t work out of the box. I can’t believe that in over 10 years the entire FB sdk team hasn’t figured out how to make an SDK. It’s taken 2 days to get past all of the build errors.

Thanks @sama-van :slight_smile:

Anyone still getting this issue in 2024?

1 Like

It’s happening to me in Unity 2022 → undefined symbol _FBAdSettingsBridgeSetAdvertiserTrackingEnabled, the solution above doesn’t help. Anyone found another solution?