iOS Build Environment Help Center

UnityAppController.h build issue

append delete AT Mike

Windows Version: 11
Builder Version: 3.61
iOS SDK Version: 17.2
Unity Version: 2022.3.20f1

Hello,
I'm having a couple of issues I've seen other people talk about on here but can't really see a fix for.

Please note that the second issue is occurring on unity 2022.3.20f1 and is NOT occurring when building the same project using 2022.3.14 (I'm trying to upgrade unity to see if it stops an ios crash happening with my project).

When building a project, the project will give one of two errors:
If the option for "try to fix unresolved symbols automatically" is off, I get the following error:

ld64.lld: error: framework not found for -framework CoreAudioTypes

If the above mentioned setting is toggled on, I get this error instead:
In file included from .\MainApp\main.mm:1:
.\UnityFramework/UnityFramework.h(4,9): fatal error: 'UnityFramework/UnityAppController.h' file not found
#import <UnityFramework/UnityAppController.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
+ [arm64] Linking Project...
ld: file not found: build/Release-iphoneos/iPhone-target/arm64/./MainApp/main.mm.obj

This file is in the build folder but its in ..UnityFramework/headers-public/UnityFramework. As mentioned, this issue occurred when building using unity 2022.3.20 but not when using 2022.3.14 with the builder attempting to fix unresolved symbols

Does anyone know of a fix for either of these errors?
If all else fails I'll just have to build with 2022.3.14 and hope it fixes the crashing.

Thanks very much for reading.

Reply RSS

Replies

append delete #1. Pierre-Marie Baty

Hello

It’s the second time someone reports this error, so it’s a strong hint that I should look into it more closely.

Could you please send me the very Xcode project that causes the "UnityAppController.h header not found" error ? I must reproduce the problem to study it. Confidentiality guaranteed.

append delete #2. Apocx_

I am also having this issue after upgrading to Unity 2023.2.8 and grabbing the latest version of iOS Project Builder for Unity (3.61.1). I was on XCode 14 and iOS 16 or something I think, but I've updated everything to the latest stable version and still have the issue.

Windows Version: 11
Builder Version: 3.61.1
iOS SDK Version: 17.2 (XCode 15.2)
Unity Version: 2023.2.8

In file included from .\MainApp\main.mm:1:
.\UnityFramework/UnityFramework.h(4,9): fatal error: 'UnityFramework/UnityAppController.h' file not found
#import <UnityFramework/UnityAppController.h>

append delete #3. Pierre-Marie Baty

I’m still in need that someone sends me a reproducible test case that I can study. I can sign a NDA if it’s necessary.

append delete #4. AT Mike

Hi Pierre,

Thanks very much, and sorry for the wait.
To prevent any messing about with NDA's I've been stripping everything out of a copy of the project and building using that to send to you.

This project build reproduces both of the errors I stated in my post, and hope it helps to narrow down what's going on with it.

Here's a link to the project build:

https://we.tl/t-oSQ5PB42et

Thanks very much,
I'll keep looking into it

append delete #5. Pierre-Marie Baty

Thank you Mike, it's downloaded. I'm going to look at it.

append delete #6. AT Mike

Hi Pierre

I don't suppose you've had a chance to look into this , have you? :)

I've got a few other random issues with the project that I believe may be fixed with a Unity update. Atm I'm unable to update as switching from 2022.3.14 to 3.20 causes the second issue with the builder, causing the project to not be buildable.

Thanks very much for the help.

append delete #7. Pierre-Marie Baty

Just finishing hunting down one pesky but potentially important bug in the POSIX emulation subsystem of my tools and I'll switch to your issue right after. Thank you for your patience :-)

append delete #8. AT Mike

Ah brilliant, thanks very much :)

append delete #9. Pierre-Marie Baty
append delete #10. AT Mike

Hi Pierre

The workaround works perfectly when 'try to resolve symbols automatically' is checked.

When 'use the LLVM linker' is checked it gives that error about the CoreAudioTypes.

I'll keep an eye on this thread, I'm hoping updating unity will solve some rare crashes we're seeing on ios devices, so this was a great help.

Thanks very much.

append delete #11. Pierre-Marie Baty

I found the problem. The public headers of the UnityFramework.framework that is built just before the main app aren't copied in the framework directory (I thought it made no point to embed source code headers when doing a binary build) but it appears the main app expects those headers to be here.

The fix is on the way.

:: @Pierre-Marie Baty added on 29 Feb ’24 · 10:07

*edit* Version 3.62 is out, and it builds your project successfully :-)

The real problem was that the public headers of a just built framework were not embedded with the framework in case the framework had no Swift module definition file. Since UnityFramework is an Objective-C framework it has no such definition file. But its Headers directory needed to be populated nonetheless after the build for the main game binary depending on it to build.

append delete #12. Apocx_

This fixed our issues, builds perfectly again. Thank you so much!

append delete #13. Pierre-Marie Baty

You’re welcome !

append delete #14. LucasDeveloper

Hello Pierre!
After Unity ads updated, it seems the bug started happening again.

append delete #15. Pierre-Marie Baty

Can you send me a reproducible test case please ?

append delete #16. AT Mike

Hello again!
Unfortunately updating the project builder to 3.62 causes other errors when building for me. With that same project I previously sent, the builder starts with the following:

While building module 'Foundation' imported from E:/Unity Projects/Builds/AT_Centrica/iOS/31 test//Classes/Prefix.pch:8:
While building module 'CoreFoundation' imported from C:\Users\micha\iOS Project Builder for Unity\SDK/System/Library/Frameworks/Foundation.framework/Headers\Foundation.h:6:

Is also generates a variety of errors just like it for Security, and UIKit. Here's the full final error in case it helps:

#import <Foundation/Foundation.h>
~~~~~~~^
+ [arm64] Compiling .\Classes\UI\UnityViewControllerBase+iOS.mm...
+ [arm64] Compiling .\Classes\UnityAppController+UnityInterface.mm...
While building module 'UIKit' imported from E:/Unity Projects/Builds/AT_Centrica/iOS/31 test//Classes/Prefix.pch:9:
While building module 'UserNotifications' imported from C:\Users\micha\iOS Project Builder for Unity\SDK/System/Library/Frameworks/UIKit.framework/Headers/UNNotificationResponse+UIKitAdditions.h:10:
In file included from <module-includes>:1:
In file included from C:\Users\micha\iOS Project Builder for Unity\SDK/System/Library/Frameworks/UserNotifications.framework/Headers\UserNotifications.h:8:
C:\Users\micha\iOS Project Builder for Unity\SDK/System/Library/Frameworks/UserNotifications.framework/Headers/NSString+UserNotifications.h(8,9): fatal error: could not build module 'Foundation'
#import <Foundation/Foundation.h>
~~~~~~~^
+ [arm64] Compiling .\Classes\Unity\CameraCapture.mm...
21 errors generated.
+ [arm64] Compiling .\Classes\PluginBase\UnityViewControllerListener.mm...
detected compiler error, aborting multithreaded build.

Any idea what could be causing this? Unfortunately the previous transfer I created has expired so I hope you've still got the project if you need it

append delete #17. Pierre-Marie Baty

@AT Mike: I suspect you reused your SDK, which implies you reused your LLVM module cache. Try cleaning the compiler cache (checkbox "Compiler cache: clean") and let me know if it fixes the problem. Also please note that locating your Xcode project closer to the drive root (here you are at "E:/Unity Projects/Builds/AT_Centrica/iOS/31 test/") is likely to avoid problems with the Windows maximum pathname length limitation of 260 characters. That's why the builder recommends that you put your Xcode projects in C:\iOS (or any other location as close as possible to a drive root).

append delete #18. AT Mike

@Pierre-Marie Baty:
Thanks very much for the feedback. Having got my hands on the mac I'm now able to update the SDK much easier.
Updating xcode and the project builder's SDK via the migration assistant has almost fixed all of the issues. Although there is one that keeps occurring anyway (The one about CoreAudioTypes), but this is fixable by changing the linker from LLVM to the other option.

Here's the info regarding the builder:
iOS builder - version 3.62 (clang 16.0.0, swiftc 5.9.1, lld 16.0.0, ld64 907-20231214) - using iOS 17.4 SDK

The error that I get when LLVM is used is:
ld64.lld: error: framework not found for -framework CoreAudioTypes

Just making you aware of this one again in case it happens to others as well. I'll be able to build the project using using the automatic fixer

append delete #19. Pierre-Marie Baty

You’re welcome. I did take note that the LLVM linker should be better aligned with the Apple one.

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Moderators: Pierre-Marie Baty