Search Unity

Headers Phase is missing in UnityFramework target in 2019.3.0f6

Discussion in 'iOS and tvOS' started by yurykorzun, Jan 30, 2020.

  1. yurykorzun

    yurykorzun

    Joined:
    Oct 29, 2015
    Posts:
    41
    After upgrading to 2019.3.0f6, new UnityFramework target has a missing Headers Phase in Build Phases in XCode.

    It produces a compiler error that UnityFramework.h is missing. I can fix it with build postprocessing, but is it a bug or I am doing something wrong?

    Thanks.
     
  2. samifruit514

    samifruit514

    Joined:
    Mar 27, 2015
    Posts:
    30
    Same thing for me. Can you tell me more with that "build processing" solution?
     
  3. yurykorzun

    yurykorzun

    Joined:
    Oct 29, 2015
    Posts:
    41
    I guess the only way is to add them manually after every build

     
  4. yurykorzun

    yurykorzun

    Joined:
    Oct 29, 2015
    Posts:
    41
    I was able to add headers using a Podfile

    Code (CSharp):
    1.  
    2. def addPublicHeaders(headers, project, headers_build_phase)
    3. headers.each do |header|
    4. puts "Adding public header #{header}"
    5. project_file = project.files.detect { |ref| ref.path.to_s.end_with?(header)}
    6.  
    7. build_file = project.new(Xcodeproj::Project::Object::PBXBuildFile)
    8. build_file.file_ref = project_file
    9. build_file.settings = { 'ATTRIBUTES' => ['Public'] }
    10.  
    11. headers_build_phase.files << build_file
    12. end
    13. end
    14.  
    15. post_install do |installer|
    16. puts "Running post install script"
    17.  
    18. project_path = File.join(File.dirname(__FILE__), "Unity-iPhone.xcodeproj")
    19.  
    20. unity_project = Xcodeproj::Project.open(project_path)
    21.  
    22. unity_main_target = unity_project.targets.detect { |target| target.name == "Unity-iPhone" }
    23. unity_framework_target = unity_project.targets.detect { |target| target.name == "UnityFramework" }
    24.  
    25. puts "Adding header build phase to #{unity_framework_target.name}"
    26.  
    27. headers_build_phase = unity_project.new(Xcodeproj::Project::Object::PBXHeadersBuildPhase)
    28. unity_framework_target.build_phases.insert(0, headers_build_phase)
    29.  
    30. addPublicHeaders(["UnityFramework.h", "RenderPluginDelegate.h", "UnityAppController.h", "UndefinePlatforms.h", "RedefinePlatforms.h", "LifeCycleListener.h"], unity_project, headers_build_phase)
    31.  
    32. puts "Updating project #{project_path}"
    33. unity_project.save
    34. end
    35.  
     
    Last edited: Jan 31, 2020
  5. kaarloew

    kaarloew

    Joined:
    Nov 1, 2018
    Posts:
    360
    What plugins do you have in your project? Crashlytics and Helpshift here.
     
  6. roberto_sc

    roberto_sc

    Joined:
    Dec 13, 2010
    Posts:
    144
    Same thing here.
    I'm also using Crashlytics and Helpshift.
     
  7. cpwfx_work

    cpwfx_work

    Joined:
    Nov 16, 2016
    Posts:
    4
    Helpshift 5.0.2 but not Crashlytics here. The phase is kept intact by adding the following line to
    Helpshift/Editor/mod_pbxproj.py: 1337
    Code (Python):
    1.                         ('PBXHeadersBuildPhase', True),
    2.  
     
    Last edited: Feb 13, 2020
  8. kaarloew

    kaarloew

    Joined:
    Nov 1, 2018
    Posts:
    360
    Problem comes from Helpshift. If I create fresh Unity project, and set target to iOS and compile, it works. If I add Helpshift plugin to Unity project, the error appears. I just contacted Helpshift support team, I will post here again when they reply.
     
  9. yurykorzun

    yurykorzun

    Joined:
    Oct 29, 2015
    Posts:
    41
    Make sure you add 3rd party dependencies to the right target in XCode. Now there are two targets instead of one. First one is UnityFramework target that has all the logic and unity engine stuff and Unity-iPhone target that launches the app and references UnityFramework. In my case, I had to add cocoapods to both targets and unlink some of them using a post install script. Potentially you might have this issue with cocoapods https://github.com/CocoaPods/CocoaPods/issues/7126

    It might be hard to resolve this issue if you don't understand how XCode and cocoapods work.
     
  10. roberto_sc

    roberto_sc

    Joined:
    Dec 13, 2010
    Posts:
    144
    This solves the problem, thank you cpwfx_work!
    I don't understand why the problem didn't happen before, though. That file didn't change, Unity version is all that had changed...
     
  11. kaarloew

    kaarloew

    Joined:
    Nov 1, 2018
    Posts:
    360
    Helpshift said that they are aware about the mod_pbxproj.py issue and that they will release an updated package at some point.
     
  12. Kujo87

    Kujo87

    Joined:
    Sep 16, 2013
    Posts:
    168
    does this PBXHeadersBuildPhase need to be added to each pbxproj.py file? I have two in mine, one for Fyber and one for Tapjoy. I've added it to both and reported the issue, but I'm just curious if there is a better solution, or it has to be modified in these files?

    As these plugins change semi-frequently, I'd like to have some kind of tidy solution that doesn't require me having to change these files every time I upgrade
     
  13. kaarloew

    kaarloew

    Joined:
    Nov 1, 2018
    Posts:
    360
    You should contact those plugin developers and tell about the issue. They should be able to fix their own plugins.
     
  14. arpanmehtaevontech

    arpanmehtaevontech

    Joined:
    Feb 28, 2023
    Posts:
    3
    #include "../UnityFramework/UnityFramework.h"


    'UnityFramework/UnityFramework.h' file not found-> GETTING THIS ERROR
    please help me out