Build iOS - Umbrella error

Why things are working, and then unity modifies something, and things stops working ?
I’m exporting my project from unity 2019.3.0 (also tried with 2019.3.3) and then try to build it in Xcode but nope, an error with swift and it can’t be done.

The error I get : “Umbrella header ‘UnityFramework.h’ not found”

Anyone has an idea how to fix that ? I smell things are gonna be fun when I’m gonna start adding analytics and ads sdk.

Did you even drag that exact error into google? Because for me it lists a very specific step to try, and I would expect if you had tried that unsuccessfully, you might have mentioned it in your post above…

Would you mind to share the link? I have the same problem and the only thing I found was this:
https://issuetracker.unity3d.com/issues/ios-swift-plugin-causes-xcode-errors-umbrella-header-not-found-and-could-not-build-objective-c-module-during-deployment
Which states that it is a regression bug and is not happening in 2020.1 beta.
@Kurt-Dekker Do you have a better resource?

Top link for me today (and probably two weeks ago when I replied) is this:

Others include:

Didn’t try any of them because I am not presently getting this error.

1 Like

I finally managed to solve that problem. In my case, I had Swift-files in a plugin, but somehow the “Objective-C Generated Interface Header” wasn’t automatically generated. I don’t know, if the problem lies on the Unity or Xcode side. I followed these steps to get the build working:

  • Comment out every single reference to a Swift class
  • Temporarily remove the Target Membership “UnityFramework” from every Swift class
  • Clean and build the project
  • Readd the Target Membership “UnityFramework” to every Swift class
  • Import the Interface Header like this: #import “UnityFramework/UnityFramework-Swift.h” ( Swift iOS native plugins hurdles )
  • Uncomment the references to the Swift classes

We are having the same issue here. Could you please elaborate on step 5? is this supposed to be included in the bridging header instead of UnityInterface.h?

You might not need this step. You only have to do this, if you are referencing any Swift-class within an Objective-C class. In order to get access to the Swift-classes you have to #import “UnityFramework/UnityFramework-Swift.h” at the top of the Objective-C class. Thats the “Objective-C Generated Interface Header” which wasn’t automatically generated and caused the umbrella error.

Hi @ElFarto , I was able to run the app directly from XCode to my test device by following your steps, but I got the same error when trying to Archive the project to upload to Appstore. Do you also have a workaround for that too?

Look in Unity-iPhone for the source of the error in the code. I think you will find main.mm to use the following:
#include <UnityFramework/UnityFramework.h> — (it should show you an error)

to fix:
#include “UnityFramework.h”

Try to follow these steps from z000z’s post ( https://discussions.unity.com/t/771039/5 ):
Then if you do write that wrapper class, you’ll have to do a few more steps for it to work:

  1. In the Xcode project go to Build Phases, select the UnityFramework Target, and then Drag the Headers section to the right under dependencies.
  2. Add your wrapper objective-c header to the Headers section, and then drag to public.
  3. Modify the UnityFramework.h to import your wrapper objective-c header, right above the UnityAppController import

That’s how I achived to archive the app. I’m not happy with that workaround at all, but at least I could build it…

Hi @ElFarto , Your solution didn’t work for me. I have a swift file which needs to be accessed in .mm file so, that I can access it in unity. I can import “UnityFramework/UnityFramework-Swift.h” on top of .mm file, But it doesn’t contain headers for my swift file.
Unity 2019.4.4f1 with Xcode 11.5

@aasiq I’ve been digging into this today on my project. You need to make sure your swift source files all target UnityFramework, comment out any use of #import “UnityFramework/UnityFramework-Swift.h” or any Swift classes in code, and get a successful build to make sure the UnityFramework-Swift.h header gets generated. Then uncomment the header, make sure you can build again, then uncomment swift calls. You’ll need to tag any classes / functions as @objc public if you want to use them in this file.

Is there any comprehensive documentation anywhere about the proper way to write a swift-based plugin wrapped to work with Unity? All I tend to find are references to approaches that used to work and threads (like this one) containing relatively obscure workarounds.
Is the state of Unity and the documentation really that sad? :slight_smile:

How to automate this from Unity?

Try this
TARGETS → UnityFramework → Apple Clang - Language - Modules
Enable Modules (C and Objective-C) set to YES

Found same issue in Unity 2020.3.7f1 with xCode 11.6 (11E708) and it was resolved just by upgrading Unity project to Unity 2019.3.15f1

umbrella header ‘UnityFramework.h’ not found
error: could not build Objective-C module ‘UnityFramework’

Related issue on issue tracker: Unity Issue Tracker - [iOS] Swift plugin causes Xcode errors &quot;Umbrella header not found&quot; and &quot;Could not build Objective-C module&quot; during deployment

Works perfectly! Thanks for sharing!