Search Unity

Build iOS - Umbrella error

Discussion in 'Scripting' started by Neriad, Mar 2, 2020.

  1. Neriad

    Neriad

    Joined:
    Feb 12, 2016
    Posts:
    125
    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.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,697
    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...
     
  3. maxim-zaks

    maxim-zaks

    Joined:
    Jul 24, 2019
    Posts:
    9
    Would you mind to share the link? I have the same problem and the only thing I found was this:
    https://issuetracker.unity3d.com/is...ot-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?
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,697
  5. ElFarto

    ElFarto

    Joined:
    Feb 26, 2015
    Posts:
    4
    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:
    1. Comment out every single reference to a Swift class
    2. Temporarily remove the Target Membership "UnityFramework" from every Swift class
    3. Clean and build the project
    4. Readd the Target Membership "UnityFramework" to every Swift class
    5. Import the Interface Header like this: #import "UnityFramework/UnityFramework-Swift.h" (https://forum.unity.com/threads/swift-ios-native-plugins-hurdles.802623/#post-5527207)
    6. Uncomment the references to the Swift classes
     
  6. MassiveTchnologies

    MassiveTchnologies

    Joined:
    Jul 5, 2016
    Posts:
    87
    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?
     
  7. ElFarto

    ElFarto

    Joined:
    Feb 26, 2015
    Posts:
    4
    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.
     
  8. n_unity467

    n_unity467

    Joined:
    Dec 17, 2018
    Posts:
    2
    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?
     
  9. drjpcody

    drjpcody

    Joined:
    Nov 13, 2018
    Posts:
    1
    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"
     
  10. ElFarto

    ElFarto

    Joined:
    Feb 26, 2015
    Posts:
    4
    Try to follow these steps from z000z's post (https://forum.unity.com/threads/swift-ios-native-plugins-hurdles.802623/#post-5527207):
    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...
     
  11. aasiq

    aasiq

    Joined:
    Dec 29, 2016
    Posts:
    16
    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
    upload_2020-7-17_15-0-12.png
     
  12. Deleted User

    Deleted User

    Guest

    @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.
     
  13. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    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? :)
     
  14. Niko-Lego

    Niko-Lego

    Joined:
    Feb 4, 2019
    Posts:
    1
    How to automate this from Unity?
     
  15. Ternovoy

    Ternovoy

    Joined:
    Dec 15, 2017
    Posts:
    3
    Try this
    TARGETS -> UnityFramework -> Apple Clang - Language - Modules
    Enable Modules (C and Objective-C) set to YES
     
  16. chakaramba

    chakaramba

    Joined:
    Apr 16, 2019
    Posts:
    6
  17. WesleyRaymundo

    WesleyRaymundo

    Joined:
    Mar 7, 2015
    Posts:
    4
    Works perfectly! Thanks for sharing!