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. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

CocoaPods installation failure when building for iOS

Discussion in 'iOS and tvOS' started by Brathnann, Sep 8, 2021.

  1. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    6,825
    I recently reset one of the work Macs and after pulling one of our repos and trying to do a build, I've been getting an error about cocoapods. The project contains Facebook, so I'm use to getting a workspace file, however because of the error, the workspace file is not generated. The console error is as follows.

    I have been trying various things, but so far, nothing has helped. I appreciate any suggestions on solutions to the issue. Thank you.

    Unity 2019.4.30
    Facebook SDK 11

    iOS framework addition failed due to a CocoaPods installation failure. This will will likely result in an non-functional Xcode project.

    After the failure, "pod repo update" was executed and succeeded. "pod install" was then attempted again, and still failed. This may be due to a broken CocoaPods installation. See: https://guides.cocoapods.org/using/troubleshooting.html for potential solutions.

    pod install output:



    [33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
    Consider adding the following to ~/.profile:

    export LANG=en_US.UTF-8
    [0m
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:166:in `unicode_normalize'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:166:in `installation_root'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:226:in `podfile_path'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/user_interface/error_report.rb:30:in `report'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:66:in `report_error'
    from /Users/fscmac/.gem/ruby/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
    from /Users/fscmac/.gem/ruby/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
    from /Users/fscmac/.gem/ruby/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:52:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/bin/pod:55:in `<top (required)>'
    from /usr/local/bin/pod:23:in `load'
    from /usr/local/bin/pod:23:in `<main>'
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:166:in `unicode_normalize'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:166:in `installation_root'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:226:in `podfile_path'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:205:in `podfile'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command/install.rb:46:in `run'
    from /Users/fscmac/.gem/ruby/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:52:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/bin/pod:55:in `<top (required)>'
    from /usr/local/bin/pod:23:in `load'
    from /usr/local/bin/pod:23:in `<main>'



    pod repo update output:

    Updating spec repo `cocoapods`
    Updating spec repo `master`


    [33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
    Consider adding the following to ~/.profile:

    export LANG=en_US.UTF-8
    [0m

    UnityEngine.Debug:LogError (object)
    Google.Logger:Log (string,Google.LogLevel) (at /Users/smiles/dev/src/unity-jar-resolver/source/VersionHandlerImpl/src/Logger.cs:127)
    Google.IOSResolver:Log (string,bool,Google.LogLevel) (at /Users/smiles/dev/src/unity-jar-resolver/source/IOSResolver/src/IOSResolver.cs:1007)
    Google.IOSResolver:OnPostProcessInstallPods (UnityEditor.BuildTarget,string) (at /Users/smiles/dev/src/unity-jar-resolver/source/IOSResolver/src/IOSResolver.cs:2331)
    UnityEngine.GUIUtility:processEvent (int,intptr) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:197)
     
  2. cratica

    cratica

    Joined:
    Dec 11, 2016
    Posts:
    47
    I am getting exact thing in my project. Just installed Facebook SDK yesterday and get this error. I too have tried many things but nothing has resolved it. Spent countless hours on this so hoping someone has an answer. I just posted this about 30 minutes ago in same forum. When I find a solution I will update my thread. GL
     
  3. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    6,825
    Thanks. I haven't found a working solution. The project builds fine on another mac and I wonder if it's maybe using an older version of cocoapods, and maybe that helps it work. Only thing I can think of since the mac it's not working on was wiped and factory reset.
     
  4. cratica

    cratica

    Joined:
    Dec 11, 2016
    Posts:
    47
    Hmmm, my mac has all the latest of everything too and its not building. What version of what needs to be reverted to what version for it to play nice who knows. I really wish all these version incompatibility issues would go away as these types of problems are the only thing that slows our development down. Maddening.
     
  5. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    6,825
    I agree. I don't know why this would break on a fresh mac setup. Luckily we have a few other macs at work, but if I were doing this at home with one mac, I'd be in trouble. I still don't have a solution. I've been trying to compare the old mac with the wiped mac to see what is different. So far, no luck.

    Edit: The wiped mac was updated to 11.5.2 Big Sur.
    The other two macs are on 11.4 still. Not sure if that is relevant.
     
  6. cratica

    cratica

    Joined:
    Dec 11, 2016
    Posts:
    47
    So I got it to build without the pod error by deselecting "use shell to execute cocoapod tool" but then I get the "can't find FBSDKCoreKitImport.h"

    I now just tried creating a brand new project in Unity's recommended version, installing only the latest FB SDK package, setting it up with my app ID and using their sample code to get just the id and username. Built it in Unity. Tried building it in Xcode and still get an immediate error "'FBSDKCoreKitImport.h' file not found. Even though this header file is found in the Pods directory of the build. Hate this stuff. :(
     
  7. pavelparatov

    pavelparatov

    Joined:
    Jun 3, 2017
    Posts:
    2
    same issue for us as well, no solution is found so far;
    Unity, help!
     
  8. Vladnee

    Vladnee

    Joined:
    Apr 28, 2017
    Posts:
    19
    It looks like this is a Unity bug: somehow it can't run the pod install command correctly.
    But there is a solution, you can install the pods manually!
    1. Right-click on the folder with the assembled build and click the "New Terminal at Folder" there
    upload_2021-9-13_14-53-25.png

    2. It will open Terminal, write "pod update" and hit enter. As a result Unity-iPhone.xcworkspace should appear in the folder
    upload_2021-9-13_15-4-12.png

    3. Open in Xcode and enjoy the build!)
    upload_2021-9-13_15-2-12.png

    PS: Additionally, I encountered a problem with the latest Facebook SDK. Dependencies with version 11.0 are not collected in xcode. To fix this, change their version to 11.1.0
    https://github.com/facebook/facebook-sdk-for-unity/issues/578#issuecomment-915959975
    upload_2021-9-13_15-2-32.png
     
  9. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    6,825
    Yeah, I can run it manually, but that didn't fix the FB problem. I'll try the Facebook fix you listed though.
    What doesn't make sense is why it works on other macs and just not the freshly restored mac. This bug really needs to be fixed.

    Thanks for the info!
     
  10. pKallv

    pKallv

    Joined:
    Mar 2, 2014
    Posts:
    1,061
    I have the same problem, we really need a fix for this.
     
  11. fcayecr

    fcayecr

    Joined:
    Jun 9, 2020
    Posts:
    5
    Thanks a lot !
    I struggled quite a bit with this problem and tried different solutions, but this actually solved it for me.
     
    Vladnee and pKallv like this.
  12. oleg_batura_tg

    oleg_batura_tg

    Joined:
    Aug 31, 2021
    Posts:
    1
    If anyone else is struggling with this error, I found a solution.
    Check the version of cocoapods installed on your machine. This can be done with a terminal command
    pod --version
    . If version is 1.11.*, which was released in september (https://github.com/CocoaPods/CocoaPods/releases) and probably not compatible with Unity 2019, you should downgrade it to the latest 1.10.* stable version. Just run commands
    sudo gem uninstall cocoapods
    and
    sudo gem install cocoapods -v 1.10.2
    .
    Hope it helps :)
     
  13. AntoinePeryKasza

    AntoinePeryKasza

    Joined:
    Sep 22, 2021
    Posts:
    1
    Thank you so much, I struggled all day on this error and that fixed it !! I hate Cocoapods so much...
     
  14. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    6,825
    +1 appears to have fixed it for us also. Thanks! Feels like something so simple and makes sense why the other macs still work as they are probably still using the older cocoapods.
     
  15. krisventure

    krisventure

    Joined:
    Mar 24, 2016
    Posts:
    118
    This solved it for me too.
     
  16. NatsuD_123

    NatsuD_123

    Joined:
    Feb 19, 2019
    Posts:
    18
    thanks. it helped
     
  17. abhijeet1001

    abhijeet1001

    Joined:
    Jan 6, 2015
    Posts:
    65
    Life saver, thanks
     
  18. mahmoud93p

    mahmoud93p

    Joined:
    Feb 11, 2015
    Posts:
    64

    Thank you for help, that is work
     
  19. aitouaddi

    aitouaddi

    Joined:
    Mar 18, 2019
    Posts:
    1
    thank you for help, this it's work for me
     
  20. PhysicsBody

    PhysicsBody

    Joined:
    Jan 10, 2020
    Posts:
    2
    Uninstalling cocoapods on my mac to 1.10.2 resolved the issue.

    I am wondering if there is a compatibility matrix for Unity and Cocoapods available online?
     
  21. djooryabi

    djooryabi

    Joined:
    Nov 6, 2020
    Posts:
    2
    Thanks, this fixed the error message in Unity 2020.3.19f1.
     
  22. prawinbhagat2022

    prawinbhagat2022

    Joined:
    Jun 16, 2021
    Posts:
    2
    I tried the above solution, but I am still getting the errors while building unity ios build in Xcode...

    I am using Unity version 2019.4.27f1
    I am using firebase sdk version 8.4.0
    facebook sdk version 9.0.0
    and Admob sdk version 5.0.0

    I am not able to generate workspace file with ios Build in Unity.
    I tried following command on mac through terminal to create workspace file
    pod install

    But it is also getting following error...

    [!] CocoaPods could not find compatible versions for pod "FirebaseCore":
    In Podfile:
    Firebase/Auth (= 8.8.0) was resolved to 8.8.0, which depends on
    Firebase/CoreOnly (= 8.8.0) was resolved to 8.8.0, which depends on
    FirebaseCore (= 8.8.0)

    Firebase/Auth (= 8.8.0) was resolved to 8.8.0, which depends on
    FirebaseAuth (~> 8.8.0) was resolved to 8.8.0, which depends on
    FirebaseCore (~> 8.0)

    CocoaPods could not find compatible versions for pod "GoogleAppMeasurement":
    In Podfile:
    Firebase/Core (= 8.8.0) was resolved to 8.8.0, which depends on
    FirebaseAnalytics (~> 8.8.0) was resolved to 8.8.0, which depends on
    FirebaseAnalytics/AdIdSupport (= 8.8.0) was resolved to 8.8.0, which depends on
    GoogleAppMeasurement (= 8.8.0)

    Google-Mobile-Ads-SDK (~> 7.53) was resolved to 7.67.0, which depends on
    GoogleAppMeasurement (~> 6.0)

    Could you please help me in this...
     
  23. egorovsa2

    egorovsa2

    Joined:
    Apr 14, 2019
    Posts:
    6
    Yes Bro! 5 hours later with you I resolved this f... ussue) THX!
     
  24. pashok77007

    pashok77007

    Joined:
    Oct 30, 2015
    Posts:
    12
    I'm using a VMware virtual machine for macOS Monterey.
    So far, I have not been able to solve the problem in this way either. Now I will try to install other versions of cocoapods....
    Have you solved the problem?
     
  25. prawinbhagat2022

    prawinbhagat2022

    Joined:
    Jun 16, 2021
    Posts:
    2
    Yes, issue got solved. I am using Admob Ads in the project. Earlier, I was using older version of Admob Ads. Later, I installed newer Admob version and uninstalled older admob version. The error of cocoapods was coming due to some files of older admob ads. After I deleted those files, the cocoapods error was eliminated.
     
  26. Jay_Sobreiro

    Jay_Sobreiro

    Joined:
    Apr 13, 2015
    Posts:
    1
    You, sir, deserve a medal!
    You just saved me (I'm using Unity 2019.4.18f1)!
    Thank you very much!
     
  27. ritesh_khokhani

    ritesh_khokhani

    Joined:
    Jun 26, 2013
    Posts:
    47

    It worked for me, thanks for saving my time.
     
  28. Ryan900

    Ryan900

    Joined:
    Jun 7, 2019
    Posts:
    4
    Holy S***, this worked! Two hours of fighting with this; thank you.
     
    pashok77007 likes this.
  29. BraveSquire

    BraveSquire

    Joined:
    Sep 25, 2018
    Posts:
    1
    You, my friend, made it onto my list of cool people.
    I was trying to fix my CI build for nearly two days now, thank you so much!
     
  30. MJBIOR

    MJBIOR

    Joined:
    Nov 20, 2017
    Posts:
    5
    I was also having an issue and the following worked for me. When I uninstalled cocoapods and tried to reinstall, it kept generating an error. The following worked and resulted in the workspace file generation for me.

    -Uninstall cocoapods: sudo gem uninstall cocoapods

    -Upgrade ruby to 3.0.0
    1. curl -sSL https://get.rvm.io | bash -s stable
    2. close and reopen terminal
    3. rvm install ruby@latest
    4. rvm use ruby-3.0.0 --default
    - Reinstall cocoapods: sudo gem install cocoapods

    Hope this helps someone else.
     
  31. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    291
    I am using Unity 2021.3.9f1. This issue still exists... Manually installing Pod works, but I have to turn off the "Use Shell to Execute Cocoapod Tool" option in the External Dependency Manager. This way, building from Unity works like a charm.
     

    Attached Files:

  32. virgilcwyile

    virgilcwyile

    Joined:
    Jan 31, 2016
    Posts:
    72
    For Unity 2021.3.9f1 I had to install latest cocoa pods using this command
    Code (CSharp):
    1. sudo gem install cocoapods -n /usr/local/bin
    Else it would always give error. And also turn off the "Use Shell to Execute Cocoapod Tool" option in the External Dependency Manager.
     
  33. patrickreece

    patrickreece

    Joined:
    Nov 14, 2019
    Posts:
    22
    My solution (that works with Unity 2019) is:

    Don’t try to modify the system ruby. This causes more problems than it solves.
    Don’t try to install other versions of ruby for Unity to use. It seems to only use the system version.
    Don’t use any ruby managers like rbenv, chruby, brew, ruby-install, asdf, either by themselves or to install cocoapods.

    For me, when installing cocoapods, I had to first switch xcode versions from my version of xcode (xcode-beta 13), to the command line tools, which use a different version of ruby.
    I ran

    Code (CSharp):
    1. sudo xcode-select --switch /Library/Developer/CommandLineTools
    2. sudo gem install cocoapods
    3. sudo arch -x86_64 gem install cocoapods
    4. sudo xcode-select --switch /Applications/Xcode-beta.app
    to switch to cmd line tools ruby, install cocoapods on both the arm and x86 architectures, and switch xcode back to the normal place, so Unity can use it to create the xcworkspace file.

    Please let me know if this is a bad idea!
     
  34. VentaGames

    VentaGames

    Joined:
    Jul 9, 2021
    Posts:
    32
  35. tpaslou

    tpaslou

    Joined:
    Mar 30, 2018
    Posts:
    10
    I have the same problem and none of the above worked

    Analyzing dependencies
    [!] CocoaPods could not find compatible versions for pod "Firebase/Analytics":
    In Podfile:
    Firebase/Analytics (= 9.6.0)
    None of your spec sources contain a spec satisfying the dependency: `Firebase/Analytics (= 9.6.0)`.
     
  36. Baydogan

    Baydogan

    Joined:
    Mar 22, 2018
    Posts:
    38
    I was having issues with ffi wrong architecture. Found the solutions from this thread.

    https://github.com/ffi/ffi/issues/864

    Code (CSharp):
    1. gem install --user-install ffi -- --enable-libffi-alloc
     
  37. pandolfini

    pandolfini

    Joined:
    Feb 5, 2020
    Posts:
    10
    If you are on an M1 Mac the correct way to resolve this is to right click (option click) on your iOS project folder to which you just built, and choose "New Terminal at Folder." Then enter "arch -x86_64 pod install" in the command line. Everything should run / build fine now. The issue is Unity attempts to install pods for non-silicon Macs.
     
unityunity