swift-unity icon indicating copy to clipboard operation
swift-unity copied to clipboard

'UnityAppController.h' file not found?

Open timnlupo opened this issue 6 years ago • 14 comments

I'm getting the error 'UnityAppController.h' file not found on build. It looks like this file is in Unity/Classes, but it's red and not in the actual folder. I know in #55 it says those form during build, but this error is preventing the build. Any ideas?

timnlupo avatar Mar 10 '18 01:03 timnlupo

Tried moving around the Unity Run Scripts to before Compile Sources in Build Phases and getting the error below. Syncing code from ... rsync: failed to open exclude file Westfield/Unity/rsync_exclude: No such file or directory (2) rsync error: error in file IO (code 11) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52/rsync/exclude.c(1005) [client=2.6.9] rsync: failed to open exclude file Westfield/Unity/rsync_exclude: No such file or directory (2) rsync error: error in file IO (code 11) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52/rsync/exclude.c(1005) [client=2.6.9] Command /bin/sh failed with exit code 11

timnlupo avatar Mar 10 '18 02:03 timnlupo

If you're using your own project, remember to copy entire Unity folder to your project first, as mentioned in step 1 here: https://github.com/jiulongw/swift-unity#xcode-1

jiulongw avatar Mar 10 '18 02:03 jiulongw

I did, any other solutions? Do I need to add a version of Classes and Libraries first?

timnlupo avatar Mar 10 '18 02:03 timnlupo

I realized my $PRODUCT_NAME was different from the project/path name so I change it. Now I get the following error, traced from the first shell script. Syncing code from ... rsync: link_stat "/Classes/." failed: No such file or directory (2) rsync error: some files could not be transferred (code 23) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52/rsync/main.c(996) [sender=2.6.9] rsync: link_stat "/Libraries/." failed: No such file or directory (2) rsync error: some files could not be transferred (code 23) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52/rsync/main.c(996) [sender=2.6.9] Command /bin/sh failed with exit code 23

timnlupo avatar Mar 10 '18 02:03 timnlupo

More updates. I realized that $UNITY_IOS_EXPORT_PATH was evaluating to nothing, hence the "/Classes/." path. I changed it to the actual path and got a stream of errors in UnityUtils.mm, below.

screen shot 2018-03-09 at 7 29 01 pm

I did a bit of research and found #38, I originally had the same problem where Exports.config file wasn't added to the Xcode project but it was in the project root. I manually added it. Further reading suggests this has something to do with Pods. My iOS project uses pods, but the Unity.xconfig file only makes reference to extra steps if the Unity project also uses pods (which mine doesn't I'm using the demo unity project). Is that correct?

I'll continue to dig but any help would be greatly appreciated. I'm using Xcode 9.2 and Unity 2017.3.1f1.

timnlupo avatar Mar 10 '18 03:03 timnlupo

Another update, I merged the two xconfig files to no avail. Same result with the merged version (the errors in UnityUtils.mm). Another thing to note, I don't think Exports.xconfig file is connected to the project. $(UNITY_IOS_EXPORT_PATH) seems to return nothing, that's what caused the code 23 and I'm still getting the code 23 or UnityUtils.mm error depending on whether or not I hardcode the path. Please help!!

timnlupo avatar Mar 10 '18 04:03 timnlupo

Could you post a gist with content of following files and their absolute paths?

  1. exports.xcconfig
  2. unity.xcconfig
  3. your pod configuration xcconfig

and a screen shot of xcode project settings showing which configuration is actually loaded.

jiulongw avatar Mar 10 '18 05:03 jiulongw

Here you go. https://gist.github.com/timnlupo/e6653bbb561058b455f475fe0d928764

timnlupo avatar Mar 11 '18 02:03 timnlupo

Copying and pasting comment from gist.

Fresh install of the project and /Unity folder. Rebuilt from Xcode and Exports.xconfig is generated but not automatically added to the Xcode project. The first build script doesn't work because it can't find $UNITY_IOS_EXPORT_PATH because the Export.xconfig file is missing (I have the same problem even if I manually add it). The build targets are below, and I'm back to the UnityUtils.mm compile errors.

screen shot 2018-03-10 at 6 20 46 pm

Absolute paths are below. /Users/tim/Desktop/Jasana/ios_centre_app/Centre/Unity/Unity.xcconfig /Users/tim/Desktop/Jasana/ios_centre_app/Centre/Unity/Exports.xcconfig /Users/tim/Desktop/Jasana/ios_centre_app/Pods/Target Support Files/Pods-Centre/Pods-Centre.us development debug.xcconfig

Note that Exports.config is currently not added to the Xcode project, but it doesn't make a difference either way.

timnlupo avatar Mar 11 '18 02:03 timnlupo

You can find out why these values are not picked up from this screen (shows you which configuration is loaded, which value is override by who, etc.)

Do you have the variables as shown in the very bottom of the screen shot?

screen shot 2018-03-10 at 8 27 42 pm

jiulongw avatar Mar 11 '18 04:03 jiulongw

Yes, I have those variables. Looks like they're updating too as I build from Unity. Think I should also note that this is an Objective C project that I'm trying to add Swift to, but don't think that should make a difference?

Do you think this ties back to the reason why Exports.xconfig doesn't automatically get added to the project? Do you have a Skype for further communication? Mine is tim.n.lupo, feel free to add.

timnlupo avatar Mar 11 '18 06:03 timnlupo

I've been continuing to research and it all seems to go back to the #38 error. Problem is when I combine the xconfigs I get the same build error, and when I can't manually combine the xconfigs because the pods are auto generated. Any ideas?

timnlupo avatar Mar 11 '18 19:03 timnlupo

Seems like making a pod library for this (which I think would auto merge configurations from different pods) is the right way to go...

The work around for now can be hard code all pod configurations files and merge them into Unity.xcconfig as I did for GVR libraries (which is also a pod library) and documented as comments in Unity.xcconfig. But that may only work for GVR and there are many configurations tied to specific pod libraries.

jiulongw avatar Mar 13 '18 04:03 jiulongw

@timnlupo did you get any solution for this issue? I am facing same issue

kiwipvt avatar Dec 24 '19 13:12 kiwipvt