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

Unity iOS project 'FBSDKShareKit/FBSDKShareKit.h' file not found

Discussion in 'iOS and tvOS' started by Asseks, Jan 4, 2020.

  1. Asseks

    Asseks

    Joined:
    Nov 22, 2019
    Posts:
    13
    I use Unity 2019.3.0f3 for export Unity to iOS as Framework. And when I open exported iOS project I get the issue
    upload_2020-1-4_14-57-1.png

    but I can navigate to this header use "Cmd+click".
    I googled and tried almost all solutions which I could find I tried set home directory for Framework Search Path to '$(HOME)/Documents/FacebookSDK' also tried set FBSDKShareKit.Framework as embeddedFramework and install Pods. Nothing helped.

    How can I figure out it?
     
    IgorAherne likes this.
  2. FardinHaque

    FardinHaque

    Joined:
    Apr 13, 2015
    Posts:
    7
    Have you managed to find out any solution? Facing this issue here as well.
     
  3. Asseks

    Asseks

    Joined:
    Nov 22, 2019
    Posts:
    13
    I downgraded FacebookSDK to 7.16.1
     
    FardinHaque likes this.
  4. FardinHaque

    FardinHaque

    Joined:
    Apr 13, 2015
    Posts:
    7
    Thanks!! That did the trick!
     
  5. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    441
    This issue appears to be first related to not having podfile generation turned on in play services resolver. You can find that here: Assets/Play Services Resolver/iOS Resolver/Settings

    Once I turned that on, I got stuck at a different issue though that appears to not have been fixed by facebook yet:
    https://github.com/facebook/facebook-sdk-for-unity/issues/350

    I used a workaround suggested here:
    https://github.com/facebook/facebook-ios-sdk/issues/1102

    Changing the FacebookSDK/Plugins/Editor/Dependencies.xml to use an earlier version of the Facebook SDK worked:

    <iosPods>
    <iosPod name="FBSDKCoreKit" version="5.8.0" />
    <iosPod name="FBSDKLoginKit" version="5.8.0" />
    <iosPod name="FBSDKShareKit" version="5.8.0" />
    </iosPods>
     
    Last edited: Jan 15, 2020
    aSayinAzerion and jeffchen930604 like this.
  6. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    536
    This didnt work for me, using Facebook sdk 7.18-2.1 and Unity 2019.2.21

    EDIT. It did work finally, I don't know what I was doing wrong.

    Still this is quite strange, the Facebook GitHub issues are closed but this still need to be fixed manually by changing the dependencies file. At least from Unity, and I'm using the last Facebook sdk 7.18-2.1 launched in February which change log says this problem is fixed.
     
    Last edited: Mar 2, 2020
    aSayinAzerion likes this.
  7. Brogan89

    Brogan89

    Joined:
    Jul 10, 2014
    Posts:
    243
    Checking `Podfile Generation` seems to be the correct fix.
    I have also posted it here in related github issue
     
  8. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    536
    Im recently getting again the exception in Unity console after build:
    FileNotFoundException: Could not find file "...../Libraries/RegisterMonoModules.h"
    My dependencies are still the same, not sure why this happens but it lets me build successfully.
     
  9. erre-rox

    erre-rox

    Joined:
    Dec 3, 2012
    Posts:
    23
    Hi,

    I'm having the FBShareKit problem with Unity 2019.4.13 and Facebook SDK 8.1.1.
    Anyone can help to resolve this?
     
    LLZ_T likes this.
  10. andersemil

    andersemil

    Joined:
    Feb 2, 2015
    Posts:
    107
    I can confirm that enabling Podfile generation in the iOS resolver cured the problem for us
     
    Victor-Cardona likes this.
  11. pauliuso

    pauliuso

    Joined:
    Dec 11, 2014
    Posts:
    8
    Guys,

    Downgrading facebook sdk version is just a temporary solution, the root cause of this error is corrupt installation of cocoapods.

    Even if unity says that cocoapods is installed it doesn't always mean that it's installed for real. To make sure, open your terminal and type 'pod' then hit enter, if it says that command not found then your cocoapods installation is broken. To fix this, run this command in terminal 'sudo gem install cocoapods'.

    Even after fixing cocoapods installation, facebook error may persist. Then try deleting unity generated xcode project, and build it again.
     
    MentalUP-IST and pistoleta like this.
  12. NoDumbQuestion

    NoDumbQuestion

    Joined:
    Nov 10, 2017
    Posts:
    186
    Facebook SDK 8.1.1 does not work with Unity 2019.4.16f1. (including podfile generation)
    Downgrade to SDK 8.1.0 solve the issue.
     
  13. BlueKyle

    BlueKyle

    Joined:
    May 9, 2014
    Posts:
    6
    Hi,
    I'm using Unity 2019.4.9f1, Facebook SDK 8.1.0, podfile generation enabled
    FBSDKShareKit problem still appear

    When I change Dependecies.xml to become like this

    <iosPods>
    <iosPod name="FBSDKCoreKit" version="5.8.0" />
    <iosPod name="FBSDKLoginKit" version="5.8.0" />
    <iosPod name="FBSDKShareKit" version="5.8.0" />
    </iosPods>


    FBSDKShareKit problem disappear, but another error appear, which is FBSDKCoreKit/FBSDKCoreKit.h file not found

    I already check pod from terminal at mac, and it run normally (I think)
    It show $ pod command ....

    Is there any idea what should I do?
     
    Last edited: Dec 10, 2020
  14. NoDumbQuestion

    NoDumbQuestion

    Joined:
    Nov 10, 2017
    Posts:
    186
    open command line in export folder that contain podfile.
    Run command `sudo pod repo update` or `pod update`

    See if it upgrade git repo in pod folder.
    Then run `pod install` see if any errors show up.

    There is an issue that cocopod failed to find newer FB version

    If error say need newer cocopod version, then sudo upgrade gem and reinstall cocopod.
    If that didn't work out, upgrade xcode version again.
     
    Last edited: Jun 2, 2021
    afoutsjr and sumut like this.
  15. BlueKyle

    BlueKyle

    Joined:
    May 9, 2014
    Posts:
    6
    Thanks, NoDumbQuestion. That do the tricks

    I have another question, do I have to run `pod install` everytime I update my unity project and build xcode for iOS?
    Even though it using the same FBSDK version
     
  16. kwikdev

    kwikdev

    Joined:
    Jun 13, 2013
    Posts:
    31
    Great job, Facebook! Another broken SDK that wastes a ton of developer time. Do they even QA this? And why doesn't Unity do something about it?

    Specifically, it's been over 2 months since the Facebook SDK release and developers are left to figure out why their apps are insta-crashing. Should be an immediate patch-fix, right?
     
    Last edited: Jan 15, 2021
    kruthikv likes this.
  17. khayri21

    khayri21

    Joined:
    Oct 20, 2020
    Posts:
    1
    I tried this commands It's work and know I can build. you need open your terminal and go to you XCode Folder then excite this commands lines. If it now work try repeat second time.

    >pod 'FBSDKShareKit'
    >pod install
     
  18. azmi_unity

    azmi_unity

    Joined:
    Dec 13, 2020
    Posts:
    60
    Try opening Xcode using the .xcworkspace file instead of .xcodeproj. And if you're building it via Jenkins, make sure to pass the xcodeWorkspaceFile parameter.
     
  19. droww

    droww

    Joined:
    Jun 26, 2014
    Posts:
    3
    I'm trying to add Facebook SDK 9.0, Unity 2019.3.9f1.
    - Podfile Generation selected,
    - can not use FB 5.8.0

    and xcode gives me

    'FBSDKCoreKit_Basics/FBSDKBasicUtility.h' file not found.

    Anyone still facing this issue?
     
  20. Tuonela93

    Tuonela93

    Joined:
    Apr 7, 2018
    Posts:
    19
    Also have this issue, Facebook SDK 9.0, Unity 2019.4.16f1

    'FBSDKShareKit/FBSDKShareKit.h' file not found'
     
  21. Tuonela93

    Tuonela93

    Joined:
    Apr 7, 2018
    Posts:
    19
    I am working on this issue since two days, I am sure that by now I've looked everywhere on the internet, no definitive solution to be found anywhere. Downgrading Facebook to any lower version does not solve the issue. I am sure that cocoapods installs everything without error. I have Appodeal and Firebase installed, if that helps. Right now the only solution I am seeing is to take Facebook completely out of my game.
     
    droww likes this.
  22. levius

    levius

    Joined:
    Jun 18, 2016
    Posts:
    19
    Me to, Facebook SDK 9.0, Unity 2019.4.18f1
     
  23. levius

    levius

    Joined:
    Jun 18, 2016
    Posts:
    19
    I got it. Steps:
    1. Delete old facebook sdk (facebooksdk and play services resolver folders)
    2. Import new Facebook SDK
    3. Build
    4. Open Terminal
    5. cd "path to builded project" (drag & drop to terminal your folder)
    6. Optional (if you have no CocoaPods enter: sudo gem install cocoapods)
    7. pod install
    8. Open Unity-iPhone.xcworkspace (not Unity-iPhone.xcodeproj)
    9. Run
    10. Profit)
     
    ClearSY, Kay86X and RendergonPolygons like this.
  24. droww

    droww

    Joined:
    Jun 26, 2014
    Posts:
    3
    Do you have to repeat the steps if you need to build again?
     
  25. droww

    droww

    Joined:
    Jun 26, 2014
    Posts:
    3
    Ok I got it. It's enough to run pod install after Unity is done building.

    Thanks @levius !
     
  26. Tuonela93

    Tuonela93

    Joined:
    Apr 7, 2018
    Posts:
    19
    The solution for me was building it from the workspace file instead of the xcodeproject. Strangely this alleviated the FBDSKSharekit.h not found error. I am now able to build and run my app on my iphone, however when I still switch to the xcode project file and build from there, I get the error. Pod install is not a problem in my case. In any case, @levius solved it for me, thanks!
     
    ranmak_unity likes this.
  27. TristanClouatre

    TristanClouatre

    Joined:
    May 20, 2020
    Posts:
    1
    Just a quick follow-up for me: TRY BUILDING FROM WORKSPACE! Thanks @Tuonela93
     
    ranmak_unity and Tuonela93 like this.
  28. tm_issq

    tm_issq

    Joined:
    Jun 22, 2018
    Posts:
    3
    unity 2019.2 and FB 9.0.0
    I ran 2 commands from terminal in folder with podfile
    pod update
    pod install
    and it helped me
     
  29. ranmak_unity

    ranmak_unity

    Joined:
    Jun 23, 2020
    Posts:
    2
    I've struggled with this for hours.
    Simply switching to Unity-iPhone.xcworkspace from Unity-iPhone.xcodeproj solved it.
    Unity 2020.3.6f1
    Facebook SDK 9.3.0
     
  30. CanerFX

    CanerFX

    Joined:
    May 16, 2021
    Posts:
    1
    Open the Xcode project with .xcworkspace instead of .xcodeproj. .xcodeproj doesn't keep SDK file indexes, that's why it gives error.
     
  31. RendergonPolygons

    RendergonPolygons

    Joined:
    Oct 9, 2019
    Posts:
    98
    Thanks a bunch @levius , that worked for me too (unity 2020.3.11f1, macos beta 12.0, xcode 12.5).

    It seems these steps need to be reproduced each time I build, anyone can suggest a more permanent solution?

    Cheers!
     
  32. bdavisdisruptorbeam

    bdavisdisruptorbeam

    Joined:
    Jun 20, 2017
    Posts:
    2
    In Assets/Play Services Resolver/iOS Resolver/Settings change the Cocoapods Integration to Xcode Project instead of Xcode Workspace if you'd rather it work when you open your xcode project. See my attached settings.
     

    Attached Files:

    colonmanuel7 likes this.
  33. AAK_Lebanon

    AAK_Lebanon

    Joined:
    May 30, 2015
    Posts:
    77
    I am using the latest version of the SDK 11.0.0 and Unity 2021.1.16 and I still have this issue when I build the code project on mac. any idea?
     
  34. cometa93

    cometa93

    Joined:
    Mar 5, 2014
    Posts:
    41
    We have had the same issue since yesterday.

    We found that working builds were downloading pod with version 11.1.0 instead of 11.2.0
    Yesterday, Facebook updated its SDK, and dependencies of the Unity SDK are giving the possibility to download higher versions than "~> 11.0" change this to "11.1.0" and will work fine.
     
    kosted, n00levoy and chriscgogii like this.
  35. Nico8292

    Nico8292

    Joined:
    Oct 14, 2019
    Posts:
    10
    Hi Cometa93
    Thanks. It works perfectly.
    For those like me who are not Unity experts, you can find the file to edit here in your Unity Project:
    /Assets/FacebookSDK/Plugins/Editor/Dependencies.xml
     
    Last edited: Sep 9, 2021
    n00levoy likes this.
  36. jcox_PlayQ

    jcox_PlayQ

    Joined:
    Jun 22, 2016
    Posts:
    9
  37. sam_paladin

    sam_paladin

    Joined:
    Oct 5, 2021
    Posts:
    12
    I am still facing same issues. I did the dependencies.xml to 11.1.0. Unity 2019.4.17f1

    Once ending compiling on Xcode and after pods downloads all it gives an error on here: updateUserProperties:handler and cannot continue.

    Any clue?
     
  38. rmgomez

    rmgomez

    Joined:
    Oct 2, 2014
    Posts:
    18
    For somebody having the same issue, here is how I fixed it:

    Ensure that you have the following External Dependency Manager Settings for iOS
    • Xcode Workspace - Add Cocoapods to the Xcode workspace

    In Unity:


    1. Search and open Assets/FacebookSDK/Plugins/Editor/Dependencies.xml

    2. Remove the ~> characters from all the <iosPod Version numbers (this means that the dependencies will use exactly the version provided instead of greater than x.xx)

    3. Your <iosPods> part of the Depenency.xml should look something like this depending on your version. Leave everything else unchanged.

    Code (CSharp):
    1.  
    2. <iosPods>
    3.         <iosPod name="FBSDKCoreKit" version="9.0" />
    4.         <iosPod name="FBSDKLoginKit" version="9.0" />
    5.         <iosPod name="FBSDKShareKit" version="9.0" />
    6.         <iosPod name="FBSDKGamingServicesKit" version="9.0" />
    7. </iosPods>
    Important: this example is for version 9.0, if you have version 11.0 keep 11.0 or whatever version you use, just remove the ~>.

    4. Build Unity Project again and verify that the console is not showing any errors.

    5. When build folder shows up, open the Unity-iPhone.xcworkspace file, if you use the xcodeproject, your xcode build will fail.
     
  39. ClearSY

    ClearSY

    Joined:
    Feb 11, 2023
    Posts:
    15
    Thanks!! This worked for me on Unity 2022.2.9f1.