I need to DL some JSON, but first things first. First, I want to just verify I have a connection on the iPad. This is what I do on Windows:
IEnumerator IsConnected(Action<bool> action)
{
UnityWebRequest request = UnityWebRequest.Get("http://www.readysetvr.com");
yield return request.SendWebRequest();
if (request.error != null)
{
action(false);
}
else
{
action(true);
}
}
On iOS (iPad mini) this never finishes. No timeout or anything. Works fine in Editor and on a MS Surface.
For quite a few years now Apple has required TLS secure transport.
Try it with an https://
URL and it should work.
Otherwise there USED to be a âallow non-TLS connectionsâ property you could set in the plist file, but I think those days are over as far as production software goes.
I know you absolutely will have your app yanked from Google (ask me how I know!) if you state âWe send all our data encryptedâ and any part of your app is found to fire off a non-encrypted request.
Pretty sure it does not apply to good old Application.OpenURL()
calls since that just forks the device browser.
1 Like
Thanks much! Using https:// fixed the problem with it hanging. But now request.error returns with âUnknown errorâ. Not too helpful. Works on Windows lol.
It shouldnât have been hanging, but rather throwing an exception and the rest of the code not executing.
Your URL does not look correct, it should have a slash at the end.
Thanks! Trying it with a slash now, but could it be something with cloud build settings? Kurt mentioned the plist file - do I need to add some post-process script in advanced settings in cloud build? Saw some reference to this for allowing âunsafeâ urls?
We have a player setting for that. If you enable unsafe HTTP in there, we add the plist item for you.
Where is this in player settings? I canât seem to find it.
Is it just the Allow âunsafeâ Code check box? I canât find anything else related to unsafe.
No, that is completely different thing.
The setting is called âAllow downloads over HTTPâ.
Got a pic or something? 2021.3.2f1 and I see no such thing.
So, that is HTTP⌠I am trying https and I still get âUnknown errorâ. Will this make any diff for https? Also I just donât see that item in settings.
This is the (very simple) code I am currently trying. Adding a slash at the end makes no diff. Note https as well.
IEnumerator checkConnection(Action<bool> action)
{
UnityWebRequest request = UnityWebRequest.Head("https://www.readysetvr.com");
request.timeout = 5;
yield return request.SendWebRequest();
if (request.error != null)
{
action(false);
}
else
{
action(true);
}
}
Also odd - your manual page under the Configuration section. Has the Allow downloads over HTTP explained, but it does not show in the screen shot for that section:
Thanks but⌠maybe a little more info would be nice. I mentioned a few times that itâs not there - not in 2021.3.2f1 so when did it get added or what can I do in the version I am using? Also I asked - I am using https - will this do anything then?
Have you actually tried the âhttps://www.readysetvr.com**/**â â note the slash at the end of url?
Yes, I have and it makes no difference and I just did another build to confirm. Still get Unknown Error. Would the âAllow httpâ thing even matter for this and any idea why I donât see it?
I installed 2021.3.22f1 and that also has no option for âallow downloads over httpâ. Can I please got some info on this?
So, am on Windows. I switched my build settings to iOS⌠and then I see that âallow unsafe httpâ but it was already checked⌠So not sure it will do anything, but I saved the project, pushed to git, and am cloud building again.
As I suspected, that setting also does nothing - since I am using https. Of course.