When I am trying to build the Xcode project, it is saying that my main.mm can not find the UnityFramework.h file. Which I checked is not missing in the Project. Can anyone give me some advice on what to do?
I have the same error. Not sure what to do.
This is known issue with Helpshift plugin (and with all plugins that use OLD mod_pbxproj). You can fix this by modifying mod_pbxproj.py file by adding ('PBXHeadersBuildPhase', True),
to line 1349 (or near it, depending about the mod_pbxproj version)
Hello everyone,
I donât have any mod_pbxproj.py in my project, so I have to update the main.mm manually. Is there any other way to change that ? (I just update the path so!)
Thank you !
You can create post process script that modifies the file manually. Something like
[PostProcessBuild]
public static void ChangeXcodePlist(BuildTarget buildTarget, string path)
{
if (buildTarget == BuildTarget.iOS)
{
// Ugly fix for missing UnityFramework.h Xcode issue
string mainAppPath = Path.Combine(path, "MainApp", "main.mm");
string mainContent = File.ReadAllText(mainAppPath);
UnityEngine.Debug.Log(mainContent);
string newContent = mainContent.Replace("#include <UnityFramework/UnityFramework.h>", @"#include ""../UnityFramework/UnityFramework.h""");
File.WriteAllText(mainAppPath, newContent)
}
}
Hello Kaarloew !
Thanks for the reply :).
I donât have access to my mac OS machine, but Iâm totally going to do that! I started modifying the file by hand and I was close the getting it to work!
Thank you for your help!
Hello @kaarloew where I can read more info how to implement such script in my unity project ? I mean is it just writing script and then I run build in Unity ?
Yes. You can read more about the PostProcessBuild in Unity - Scripting API: PostProcessBuildAttribute
I have the same error. It started after I cleaned the project in xcode. I have spent all day on that error please help!!!
Ok I finally got it! You can change the code in main.mm by hand. I changed it from <UnityFramwork/UnityFramwork.h> To ââŚ/UnityFramwork/UnityFramwork.hâ
Dude, its framework not framwork - #include "../UnityFramework/UnityFramework.h"
Dude, UnityFramwork for days.
This worked for me!! After 9-10 hours of searching for a solution to this error: âdefines.hâ file not found
Probably will use the post process script for new builds, but changing the main.mm file in xcode was simple enough to test it.
I canât explain exactly why this happened, nor why my solution worked, but I found that in my Products folder, there were multiple folders. One was âReleaseForRunning-iphoneosâ - thatâs the one from which Xcode was building. That one didnât contain the UnityFramework folder, but another - âReleaseForRunning-iphonesimulatorâ did. I copied that folder over (itâs all for the same app after all, right?) and the build succeeded.
After fiddling with this same problem for an hour or two, I solved by just clearing the build folder.
where is this file located?
After fixing this issue I have another issue with unityappcontroller.h file is not found.
i am getting this error while include this â
#include <UnityFramework/UnityFramework.h>
Error ->UnityFramework/UnityFramework.hâ file not foundâŚ
Please Help me out
A recent version of Unity (2022.3.18 onwards) broke IOS builds if using IOS Project Builder. Also broken in the current Unity version. I am posting the error below (for anyone searching the internet for a solution to this problem) and the fix below that.
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 âŚ
ld64.lld: error: cannot open build/Release-iphoneos/iPhone-target/arm64/./MainApp/main.mm.obj: no such file or directory
ld64.lld: error: undefined symbol: main
To fix, add this code in a file like Editor/PostProcessBuildClass.cs:
static class PostProcessBuildClass {
[PostProcessBuild]
public static void ChangeXcodePlist(BuildTarget buildTarget, string path) {
Debug.Log("Post process build ChangeXcodePlist");
if (buildTarget == BuildTarget.iOS) {
string mainAppPath = Path.Combine(path, "UnityFramework", "UnityFramework.h");
string mainContent = File.ReadAllText(mainAppPath);
string newContent = mainContent.Replace("#import <UnityFramework/UnityAppController.h>", "#import <Classes/UnityAppController.h>");
File.WriteAllText(mainAppPath, newContent);
}
}
}
Iâm my scenario, for some reason using Unity 2022.3.20f1 I had to ad both patches.
The main.mm and UnityFramework.h