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

Bug 'IronSource/IronSource.h' file not found

Discussion in 'LevelPlay' started by milox777, Jun 8, 2023.

  1. milox777

    milox777

    Joined:
    Sep 23, 2012
    Posts:
    180
    I have another problem with IronSource SDK on Unity 2021.3.26f1 LTS. This time trying to build for iOS in Xcode 14.2 (latest), I get this error:

    Code (CSharp):
    1. IronSource/Plugins/iOS/iOSBridge.h:10:9 'IronSource/IronSource.h' file not found
    It appears I'm not the one with this problem on the latest IronSource SDK 7.3.0.1, here on this youtube video:


    they suggest to rollback to previous version which contains the IronSource.framework which appears to be missing from the latest version thus causing the error.

    But I'd like the official answer to this issue. Here's my iOS resolver settings in Unity, just the default settings. I clicked "install cocoapods" too, tried changing to "Add cocoapods to project" and disabling bitcode, but this doesn't appear to do anything.

     
  2. milox777

    milox777

    Joined:
    Sep 23, 2012
    Posts:
    180
    So it seems that someone had this problem here as well:

    Code (CSharp):
    1. https://forum.unity.com/threads/iosbridge-ironsource-ironsource-h-file-not-found.1426446/
    I can confirm that installing cocoapods via homebrew (couldn't install it otherwise) and running
    Code (CSharp):
    1. pod install --verbose
    in the Xcode Unity project directory, and then opening the Xcode workspace file instead of the Xcode project, then disabling bitcode for every project in the workspace (including the Pods project) fixes the problem and the build succeeds.

    But holy hell, is there any way this process can be improved? What a nightmare Apple dev ecosystem is...
     
    akasabutski likes this.
  3. cnguyen_unitylevelplay

    cnguyen_unitylevelplay

    Unity Technologies

    Joined:
    Mar 23, 2023
    Posts:
    66
    Hi @milox777
    It sounds like the pod isn't pulling in the required frameworks. Could you verify the pod files exists in your imported xcode project after installing cocoapods via the Assets > Mobile Dependency Resolver menu? We'll try to repro this on our end too

    Edit: I didn't see your response until after my reply. This is just the nature of xcode and cocoapods at the moment
     
  4. milox777

    milox777

    Joined:
    Sep 23, 2012
    Posts:
    180
    Thank you for the reply, I managed to fix that on my own but I seem to still have a problem with Mediation Testing being blocked on networks other than ironSource, please check back our PM conversation.
     
  5. akasabutski

    akasabutski

    Joined:
    Nov 7, 2018
    Posts:
    11

    Okay, I used your approach to solve my IronSource problems and then automated it.
    1. Unity ios resolver failed at installing cocoapods due to old Ruby installed on Mac OS. Although I had the newest version installed by Brew, the PATH was prioritizing older /usr/bin version.
    1.1. Remove old cocoapods (if you installed via Brew without --user-install).
    1.2.
    brew install ruby
    . Find your Ruby location (like /usr/local/Cellar/ruby/3.2.2/bin)
    1.3.
    sudo vi /etc/paths
    . Insert new line of Brew's Ruby path before /usr/bin line.
    1.4. Now your PATH will point to correct Ruby. Restart UnityHub & Unity so it will refresh the PATH variable.
    1.5. Try installing cocoapods via ios resolver again. Should work lol.

    2. During the build, I had another issue with UTF-8. Unity recommended adding
    export LANG=en_US.UTF-8
    to ~/.profile. This helped. Now, after building ios, I finally have Pods folder. I don't need to use "pod install" separately.

    3. Now we need to disable bitcode. It was deprecated by Apple anyway and won't come back. All you need is to disable it for all your targets. Project settings still might say YES, but it gets overridden by targets settings. I have a class that automatically does it after each build.

    Code (CSharp):
    1. using UnityEditor;
    2. using System.IO;
    3. using System;
    4. #if UNITY_IOS
    5. using UnityEditor.Callbacks;
    6. using System.Diagnostics;
    7. using UnityEditor.iOS.Xcode;
    8.  
    9.  
    10. public class IOSPostBuild {
    11.  
    12.     [PostProcessBuild]
    13.     public static void ChangeXCodeProperties(BuildTarget buildTarget, string pathToBuiltProject) {
    14.         if (buildTarget == BuildTarget.iOS) {
    15.             string projectPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";
    16.  
    17.             var pbxProject = new PBXProject();
    18.             pbxProject.ReadFromFile(projectPath);
    19.             var bitcodeKey = "ENABLE_BITCODE";
    20.  
    21.             foreach (var target in new string[] {
    22.                 pbxProject.GetUnityMainTargetGuid(), //Main
    23.                 pbxProject.TargetGuidByName(PBXProject.GetUnityTestTargetName()), //Unity Tests
    24.                 pbxProject.GetUnityFrameworkTargetGuid() //Unity Framework
    25.             })
    26.                 pbxProject.SetBuildProperty(target, bitcodeKey, "NO");
    27.  
    28.             pbxProject.WriteToFile(projectPath);
    29.         }
    30.     }
    31. }
    32. #endif
    Now I also don't need to change bitcode settings manually. And yes, I still have to open the workspace file instead of the project file, this way Pods folder is automatically included in XCode.
     
    Pyr3z and milox777 like this.
  6. fedemg15

    fedemg15

    Joined:
    Apr 7, 2019
    Posts:
    2
    This might be a noob work around but I fixed it by manually downloading the corresponding iOS SDK, unzipping it and adding the IronSource.framework folder in Assets/IronSource/Plugins/iOS.