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.
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.
Make sure you have cocoapods installed. At the terminal, type “sudo gem install cocoapods”
Build for iOS from Unity, which creates a Unity-iPhone.xcodeproj project file and a podfile.
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.
@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).
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.
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
Unity → ExternalDependencyManager → IOS Resolver Settings - make it build to a Xcode project and make sure all the checkboxes are checked.
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’
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!
[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’
[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’
Once the Pod Install is successful, double click the newly created ‘Unity-iPhone.xcworkspace’ in your project directory to open the workspace in Xcode.
Xcode->The folder option → Unity-IPhone-> under Projects select ‘UnityFramework’-> select ‘Build Phases’ then drag the ‘> Headers’ above the ‘> Compile Sources’
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 :
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.
It’s happening to me in Unity 2022 → undefined symbol _FBAdSettingsBridgeSetAdvertiserTrackingEnabled, the solution above doesn’t help. Anyone found another solution?