Search Unity

Facebook SDK Error: 'FBSDKShareKit/FBSDKShareKit.h' file not found

Discussion in 'iOS and tvOS' started by Fluzing, Sep 28, 2015.

  1. Fluzing

    Fluzing

    Joined:
    Apr 5, 2013
    Posts:
    815
    I have added the new Facebook SDK to my project, but I cannot get it to work (version 7.1.0).

    When I try to build my project in XCode, the following error pops up:

    'FBSDKShareKit/FBSDKShareKit.h' file not found

    The file is present in my project in the folder:

    "Assets\Plugins\iOS\Facebook\FBSDKShareKit.framework\Headers"


    This is exactly when the installer put it and I have not changed a thing.
    There are several posts about this, but they all suggest you change something in XCode, which is not a real sollution as it requires me to change it every time I want to build the project. Also, the suggestions don't seem to work anyway.

    What am I doing wrong? I have removed Facebook files and reimported them, but that does not do anything. I have tried making an empty project, import the Facebook SDK, but then the same error pops up.

    Does anyone have a suggestion?
     
    IgorAherne likes this.
  2. Icaro-Malta

    Icaro-Malta

    Joined:
    Jan 21, 2013
    Posts:
    5
    Facebook post process isn't adding facebook frameworks path to the frameworks search path. I created a new post process script to solve this issue, you just need to download and put it on your Editor folder.
    ( It's an unofficial solution :) )
     

    Attached Files:

  3. fred_gds

    fred_gds

    Joined:
    Sep 20, 2012
    Posts:
    184
    Thanks.

    Do you know why I get an error in Monodevelop but not in Unity?
    In Mono it says that xCode is not part of the UnityEditor.iOS namespace.
     
    Last edited: Oct 7, 2015
  4. Icaro-Malta

    Icaro-Malta

    Joined:
    Jan 21, 2013
    Posts:
    5
    fred_gds, you are using unity 4 and this script was created in unity 5.

    I think that PBXProject(http://docs.unity3d.com/ScriptReference/iOS.Xcode.PBXProject.html) was introduced in Unity 5, so you won't be able to use it without upgrading your project,
    or importing XCodeEditor-for-Unity(https://github.com/dcariola/XCodeEditor-for-Unity) in your project and change the code to reference this namespace.
     
  5. fred_gds

    fred_gds

    Joined:
    Sep 20, 2012
    Posts:
    184
    Thanks for the answer I use Unity 5. So I guess I will have to reimport the namespace. But it seems to be some error with monodevelop as Unity will not throw any errors…
     
  6. Skjalg

    Skjalg

    Joined:
    May 25, 2009
    Posts:
    211
    Theres two good stackoverflow posts regarding the same thing. They basically boil down to the fact that the frameworks search paths in Build Settings is wrong. Some users are experiencing that the slashes in the file path is the wrong way as in \ instead of /.

    $(inherited) $(PROJECT_DIR)/Frameworks\Plugins/iOS/Facebook

    For me however, it was the fact that the whole thing was missing quotation marks as I had a folder in the path with space in it.

    $(inherited) "$(PROJECT_DIR)/Frameworks/Plugins/iOS/Facebook"
     
  7. KevinCodes4Food

    KevinCodes4Food

    Joined:
    Dec 6, 2013
    Posts:
    61
    Thanks, Sklag, that fixed it for me!
     
  8. gastoninfante2

    gastoninfante2

    Joined:
    Nov 14, 2017
    Posts:
    1
    1. Open the terminal
    2. Check that git is installed by running this command : git --version (otherwise follow this article to install it https://confluence.atlassian.com/crucible045/installing-and-upgrading-git-947848144.html)
    3. Go the root folder of your Xcode generated project by running: cd Xcode project path
    4. Run this command : sudo gem install cocoapods
    5. Run this command : pod update
    6. Open again your Xcode project(from .workspace file) and build
     
    IgorAherne likes this.
  9. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    THIS IS CORRECT.

    Basically newer versions of facebook sdk do not include frameworks, it is expected of you to download them using cocoapods.

    So, after compiling via unity while on windows, I copied my resulting folder and pasted it into my macbook.

    You then need to call the
    pod install 
    command from that folder (by opening Terminal and navigating to the folder where your xcode is, then executing 'pod install'). Cocoapods will download what you need, and then you can compile.

    It might take 20 minutes until
    pod install
    actually completes. To me it seamed frozen, but you can open Resource Monitor and see under the Network tab that Cocoapods indeed is downloading stuff from internet. So just give it some time.

    Then, look in the terminal for the further instructions (basically it will generate a new file, through which you must open your project from now on).
     
    Last edited: Jan 13, 2021
    KaryaNeonPlay and an_n like this.
  10. unaisanchezl

    unaisanchezl

    Joined:
    May 16, 2018
    Posts:
    3
    I do that on my projects but just after doing it, i open xcode and try to build the game and get 100 errors... UNDEFINED SYMBOL: