Xcode build Error : 'UnityFramework/UnityFramework.h' file not found in FBUnitySDKDelegate

Hi, I get this error when trying to build or run the game ‘UnityFramework/UnityFramework.h’ file not found.

Podfile

Unity Version: 2020.3.40f1

@DeclanMcPartlin

Hi @weizheng2 ,

Your Podfile is not going to work with the dependencies you have included. I’d recommend checking out how our Unity Mediation product generates the Podfile (by installing our UPM package through package manager) and use what is useful to you.

Facebook are also clearly making custom changes to the Podfile, so you might also want to reach out to them if you prefer.

Thanks.

As a manual test, you can see if switching out:

use_frameworks! :linkage => :static
use_frameworks!

With this:

use_frameworks!

target 'Unity-iPhone' do
end

post_install do |installer|
  applicationTargets = [
    'Pods-Unity-iPhone',
  ]
  libraryTargets = [
    'Pods-UnityFramework',
  ]

  embedded_targets = installer.aggregate_targets.select { |aggregate_target|
    libraryTargets.include? aggregate_target.name
  }
  embedded_pod_targets = embedded_targets.flat_map { |embedded_target| embedded_target.pod_targets }
  host_targets = installer.aggregate_targets.select { |aggregate_target|
    applicationTargets.include? aggregate_target.name
  }

  host_targets.each do |host_target|
    host_target.xcconfigs.each do |config_name, config_file|
      host_target.pod_targets.each do |pod_target|
        if embedded_pod_targets.include? pod_target
          pod_target.specs.each do |spec|
            if spec.attributes_hash['ios'] != nil
              frameworkPaths = spec.attributes_hash['ios']['vendored_frameworks']
            else
              frameworkPaths = spec.attributes_hash['vendored_frameworks']
            end
            if frameworkPaths != nil
              frameworkNames = Array(frameworkPaths).map(&:to_s).map do |filename|
                extension = File.extname filename
                File.basename filename, extension
              end
              frameworkNames.each do |name|
                puts "Removing #{name} from OTHER_LDFLAGS of target #{host_target.name}"
                config_file.frameworks.delete(name)
              end
            end
          end
        end
      end
      xcconfig_path = host_target.xcconfig_path(config_name)
      config_file.save_as(xcconfig_path)
    end
  end
end

Then running: pod install in the generated Xcode project from Terminal solves your issue.