Hey, I have been trying to add a button that takes the player to an external link. I have added the necessary button and binded to it’s OnClick Event.
When I try to test it, the button works just as intended and it takes me to the link. The problem is when I try to test this button out through my phone after generating a build, it doesn’t open up my browser window.
After googling for a bit, I understood that people had run into similar issues where they fixed it by using a string variable rather than passing the actual link. As you can see, I tried the same solution here as well but the results are the same.
If someone can help me out with this, I would really appericiate it. Thank you so much!
[SerializeField] private string websiteLink;
public void OpenLink()
{
// Function used to take the players to an external site
Application.OpenURL(websiteLink);
}
how are you running it on ios? ios build or webgl? did you enable web calls in the build settings?
1 Like
I generate builds through Testflight.
Web calls in the build settings? Can you point me to where it can be found? Taking a look right now!
Oh I have seen that. I assumed it was for downloading files through a link or something and completely disregarded that. Thanks, will give this a try!
That setting has nothing to do with Application.OpenURL.
You need to investigate what URL is being passed at runtime, maybe it is different on phone for whatever reason.
1 Like
That’s what I thought. Wasn’t working.
It’s not working with any URL, I tried multiple including just a normal www.google.com. Both with http and without.
Just to note, all URLs work fine on the editor. I just get this issue with the buids
Are you using http or https?
Safari may be reject http.
1 Like
I have tried both, but just to confirm doing another build with https right now. Will get back to you with the results. Thank you!
Just tested it. https doesn’t seem to be working either.
This is the error I get in XCode while testing.
BUG IN CLIENT OF UIKIT: The caller of UIApplication.openURL(_:) needs to migrate to the non-deprecated UIApplication.open(_:options:completionHandler:). Force returning false (NO).
Any other possible workarounds?
Sounds like you use older version of Unity.
If you don’t want to upgrade, find where Unity calls openURL in Xcode project and update the call.
1 Like
If you don’t mind, can you help me or point me to a resource where I could see how I could do this? ( updating the call )
My bad, it’s not exposed, so upgrading Unity is the only option.
2 Likes
Damn, okay! Thanks for the help