SafariServices/SafariServices.h is missing when building to tvOS

Hello, friends,
I stumbled across a problem where my app builds ok in Unity, but when I try to build it in xcode it results in build error, stating SafariServices.h is missing. I attached a screenshot of the error. Does anyone know how to resolve this? I have no idea how to proceed.

I have exactly the same problem, any update about this issue ?

This is some additional plugin depending on the SafariServices Framework. Frameworks aren’t included automatically, they need to be linked explicitly. Where did you get this plugin and did you follow all the setup instructions?

Try enabling “SafariServices” under “Framework dependencies” on the plugin inspector of the “SafariView.mm” file in Unity.

Thanks for your reply. Actually this error will happen when we add the Authentication Package from Unity (com.unity.services.authentication).
I tested it now on an empty project on unity 6, after the build to xcode, i see this error in Xcode.
I can’t find the file “SafariView.mm” in Unity

I don’t think “SafariView.mm” is coming from an official package. Those are usually in a “Libraries/com.unity.x/” subfolder.

Maybe it’s coming from another non-official package? Try to search in “Library/PackageCache” in your project.

Maybe also try a clean build into a new folder, to make sure it’s not something old remaining in the Xcode project?

Actually I’ve found it in the Packages folder but I can’t change it. however I copied it to the assets folder, but i can’t see the safari services in the inspector.
in Xcode, I see an error saying the the SafariServices are not available when building for tvOS !

So I think we are in stuck now…

What package is it?

You can embed packages to make them part of the project and editable.

Yeah, there’s no Safari on tvOS. You should be able to exclude the plugin from tvOS instead. But whatever is using the plugin needs to have an alternative for tvOS that doesn’t use Safari. E.g. for OAuth, you’d use code based authorization instead of web.

1 Like

I’ve resolved the issue by removing the SafariView.mm file from the Libraries folder in the xCode project. It was located at ‘/Users/me/Documents/Unity Projects/mygame/Builds/AppleTV/Libraries/com.unity.services.authentication’.

I’ve built the project and the sign-in worked successfully (I tested it in the simulator).

Thanks a bunch, Adrian, for pointing out the cause of this bug!

As a refernece, I am using Unity 6 (6000.0.36) with the latest updated packages and the latest xCode (16.2) on Mac Sequoia 15.3

1 Like