Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Facebook SDK build issue with FBSDKCoreKit

Discussion in 'iOS and tvOS' started by Gillissie, May 15, 2020.

  1. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    294
    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. https://developers.facebook.com/docs/ios/getting-started/

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

    Code (csharp):
    1. ld: warning: directory not found for option '-L/Users/gillissie/Library/Developer/Xcode/DerivedData/Unity-iPhone-bujqldfjsyjydhgiestqkfocmauj/Build/Products/ReleaseForRunning-iphoneos/FBSDKCoreKit'
    2. ld: warning: directory not found for option '-L/Users/gillissie/Library/Developer/Xcode/DerivedData/Unity-iPhone-bujqldfjsyjydhgiestqkfocmauj/Build/Products/ReleaseForRunning-iphoneos/FBSDKGamingServicesKit'
    3. ld: warning: directory not found for option '-L/Users/gillissie/Library/Developer/Xcode/DerivedData/Unity-iPhone-bujqldfjsyjydhgiestqkfocmauj/Build/Products/ReleaseForRunning-iphoneos/FBSDKLoginKit'
    4. ld: warning: directory not found for option '-L/Users/gillissie/Library/Developer/Xcode/DerivedData/Unity-iPhone-bujqldfjsyjydhgiestqkfocmauj/Build/Products/ReleaseForRunning-iphoneos/FBSDKShareKit'
    5. 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. :(

    Thanks!
     
  2. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    294
    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.

    0. Make sure you have cocoapods installed. At the terminal, type "sudo gem install cocoapods"
    1. Build for iOS from Unity, which creates a Unity-iPhone.xcodeproj project file and a podfile.
    2. 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

    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.
     
  3. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    294
    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.
     
  4. YRC

    YRC

    Joined:
    May 24, 2020
    Posts:
    1
    OMG,I have this problem, too
     
  5. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    294
    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.
     
  6. ExNinja

    ExNinja

    Joined:
    Dec 4, 2013
    Posts:
    29
    @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. https://developers.facebook.com/docs/unity/upgrading-7.x#setup
     
    Last edited: Jun 21, 2020
  7. jcox_PlayQ

    jcox_PlayQ

    Joined:
    Jun 22, 2016
    Posts:
    9
    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 https://github.com/facebook/facebook-sdk-for-unity/issues/578).
     
  8. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    319
    I have the same problem, but xcodeproject is not beeing generated. Any advice?
     
  9. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    294
    I'd guess thata if xcodeproject isn't being generated, then your whole build isn't succeeding for another reason.
     
  10. Valhalaru

    Valhalaru

    Joined:
    Feb 3, 2016
    Posts:
    9
    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.
     
    chrismarch and martinsellmair like this.
  11. Valhalaru

    Valhalaru

    Joined:
    Feb 3, 2016
    Posts:
    9
    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’


    3. MacOS->Podfile - the pod file in your project should look like this for Facebook SDK 11

    Code (Boo):
    1. source 'https://cdn.cocoapods.org/'
    2.  
    3. platform :ios, '11.0'
    4.  
    5.  
    6. target 'UnityFramework' do
    7.  
    8.   pod 'FBSDKCoreKit', '~> 11.1.0', :modular_headers => true
    9.  
    10.   pod 'FBSDKCoreKit_Basics', '~> 11.1.0'
    11.  
    12.   pod 'FBSDKGamingServicesKit', '~> 11.1.0'
    13.  
    14.   pod 'FBSDKLoginKit', '~> 11.1.0'
    15.  
    16.   pod 'FBSDKShareKit', '~> 11.1.0'
    17.  
    18. end
    19.  
    20. target 'Unity-iPhone' do
    21.  
    22. end
    23.  
    24. use_frameworks! :linkage => :static
    25.  
    26. use_frameworks!
    4. [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 - https://github.com/CocoaPods/CocoaPods/issues/10723 [super helpful!]


    5. [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’


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


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

    -Full details here (https://forum.unity.com/threads/xcode-version-13-3-13e113-error-cycle-in-dependencies.1268720/)


    8. 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 - https://stackoverflow.com/questions...dle-the-bundle-at-contains-disallowed-file-fr


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

    tpaslou

    Joined:
    Mar 30, 2018
    Posts:
    10
    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'
     
  13. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,723
    Same issue here with Facebook SDK 15.1 :D :D
    Unity 2021.3.16f1 // OS Ventura 13.2
     
  14. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,723
    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 :

    Screenshot 2566-01-27 at 09.26.19.png

    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 :
    - https://github.com/facebook/faceboo...7xlCGFYN6C1F8oYcwfBJg#issuecomment-1404894047
     
  15. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    832
    Just ran into this problem. It's pretty grim!

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

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    418

    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.
     
  17. MohammadAlkhalailah

    MohammadAlkhalailah

    Joined:
    Aug 16, 2017
    Posts:
    5