[英]UnityWebRequest not working after updating Android OS
The following used to work on both the PC Unity Editor and my mobile device: 以下内容可同时在PC Unity Editor和我的移动设备上使用:
WWWForm Fields = new WWWForm();
Fields.AddField("dummy","");
UnityWebRequest www = UnityWebRequest.Post(Apis.internetTest, Fields);
yield return www.SendWebRequest();
After updating the Android OS on my mobile device, it will always return an 'Unknown Error'. 在移动设备上更新Android OS后,它将始终返回“未知错误”。
So for now, my game would work on some older phones, but not on phones with updated Android OS. 因此,目前,我的游戏可以在某些较旧的手机上运行,但不能在具有更新的Android OS的手机上运行。
I am Using Unity 2018.4.2f1. 我正在使用Unity 2018.4.2f1。 How can I solve this problem?
我怎么解决这个问题?
Reference: UnityWebRequest . 参考: UnityWebRequest 。
Apis.internetTest is: Apis.internetTest是:
http://quizjungle-app.com/internet-test
Google has enforced the use of HTTPS (ie. no more HTTP) on newer Android devices. Google已在较新的Android设备上强制使用HTTPS(即不再使用HTTP)。 That's why the connection broke for my case.
这就是我的情况下连接断开的原因。 I have solved it by adding [android:usesCleartextTraffic="true"] in the opening tag of < application> in AndroidManifest.xml in the android plugin directory.
我已通过在android插件目录中的AndroidManifest.xml的<application>的开始标签中添加[android:usesCleartextTraffic =“ true”]来解决此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.