iOS Build Environment Help Center

'UnityAds/UnityAds.h' file not found

append delete brian

• Windows version: 10
• Builder version: 3.70.3
• iOS SDK version: 17.5

I am receiving error: fatal error: 'UnityAds/UnityAds.h' file not found

https://pmbaty.com/paste/?41de294798a5dd79#9r6BNSUkruhexQfKaNhDRkDsZNf2SHXwLCK15CdmqVnq

My project builds fine for Android and Unity Ads work properly, so I *think* I have Unity Ads integrated correctly in the project.

Reply RSS

Replies

append delete #1. Pierre-Marie Baty

Assuming a UnityAds.h file exists in a subdirectory called UnityAds somewhere in your Xcode project, this is the symptom of a missing include path.

You can work it around by supplying the relative path to the directory where that UnityAds subdirectory (the one that contains the UnityAds.h file) is located to the compiler using the -I (capital i) compiler flag, like this:

% extra compiler flags
-Ipath/to/the/directory/containing/the/UnityAds/subdir
%

In case this fixes the problem, it would be interesting to know whether Xcode can build this project. If not, it'd be the sign that UnityAds was not correctly integrated. If it does, it'd be the sign that the builder doesn't pick up the include path and that's something I'd need to investigate.

append delete #2. brian

Hmm... no UnityAds.h file anywhere in the xcode project. Not sure what else is needed for UnityAds integration. It builds and works properly on Android.

I'll look at my project again and see if there is somewhere I can enable for iOS.

append delete #3. brian

Is there a chance that CocoaPods have something to do with this issue?

From: https://docs.unity.com/ads/en-us/manual/InstallingTheiOSSDK

To use CocoaPods for UnityAds:
Add the following line to your project's Podfile:
pod 'UnityAds'
Run the following command:
pod install

I'm at a loss on how to get UnityAds.h to be included, or a UnityAds folder included.

append delete #4. Pierre-Marie Baty

If UnityAds is deployed as a pod, then yes, you need CocoaPods. If your builder is configured to skip CocoaPods, or if CocoaPods is otherwise disabled, it won't deploy UnityAds in your Xcode project. There might be alternate ways to deploy UnityAds than with CocoaPods, I don't know: check the Unity documentation about that.

append delete #5. brian

Adding Unity version in case that helps:

*• Windows version: 10
• Builder version: 3.70.3
• iOS SDK version: 17.5
• Unity version: 2022.3.55f1*

When you say "builder", you mean the Unity builder, not iOS builder, right?

Looking at documentation, it shows I can add the pod commands to the project's Podfile (I have no idea what that is). The other method is to "Drag and drop the Unity Ads framework into your workspace." I'm assuming that means the xCode workspace running on Mac. I don't build on Mac, so I'm not exactly sure.

Other suggestions I've found use Ruby, Gems, Homebrew to get CocoaPods installed, but those are all Mac related I believe. I was hoping to find a solution that would work for PC... that's why I like iOS Project Builder so much - No Mac required :)

I'm going to keep looking at forums to see if someone else has solved this on PC. I can't believe more people aren't having this same issue. It's not like I'm using Unity 2018 or something way out of date. Yes, 2022 is "old" but it's still LTS.

append delete #6. Pierre-Marie Baty

I meant the iOS builder: there is a checkbox in the UI that disables CocoaPods. CocoaPods also won't be started if you opt to install the frameworks manually when asked (in this case, the Podfile is renamed Podfile.bak).

CocoaPods is an optional add-on package with the iOS Builder, not everybody needs it. It needs an activation key. If you haven't gotten one, and/or opted not to use it, CocoaPods won't be used when you click the Build button.

append delete #7. brian

So if I get an activation key for CocoaPods, the build should work?

If so, how do I purchase an activation key? iOS Builder docs say it asks at initial boot. Do I re-insall the builder to do it?

Thanks in advance

append delete #8. brian

Re-read Unity Docs and found a link to the UnityAds Framework. I misread it the first time I went through the docs and thought it was the package from the package manager.

Just in case someone else needs it, here is the link via Unity Docs:

https://github.com/Unity-Technologies/unity-ads-ios/releases

But now I have new errors. A new adventure!

append delete #9. Pierre-Marie Baty

I suppose your new error was this one, which is solved too ? https://www.pmbaty.com/iosbuildenv/help/thread.php?path=Problem%20solving/&file=error-linking-unityframework

Happy building

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