您正在使用http下载。 目前,Unity将NSAllowsArbitraryLoads添加到Info.plist以简化转换

使用Unity为iOS和Android制作应用程序。

我现在卡在iOS问题上:

You are using download over http. Currently unity adds `NSAllowsArbitraryLoads` to `Info.plist` to simplify transition, but it will be removed soon. Please consider updating to https. 

不受支持的url

实际问题是:
I connect to an https address
I did set the Allow Arbitrary Loads to YES

然而,它没有用。

这是我的代码:

 string GET = "mail="+mail+"&nome="+nome+"&cognome="+cognome; // get parameters WWW response = new WWW (SERVER+"adduser/?"+GET); // calling page, address is like 'https://website.com/' while (!response.isDone && response.error != "") { yield return null; } if (response.error != "") { print (response.error); return false; } 

显然,这是在IEnumerator函数中,它总是返回先前的错误。

Apple停止在iOS设备上允许http连接。 您仍然可以通过将NSAppTransportSecurity添加到info.plist来使用http连接,但将来会删除它。建议您从现在开始使用https连接。

引入UnityWebRequest是为了通过将NSAppTransportSecurity添加到info.plist来自动解决此问题。

 IEnumerator makeRequest() { string GET = "mail=" + mail + "&nome=" + nome + "&cognome=" + cognome; UnityWebRequest www = UnityWebRequest.Get(SERVER + "adduser/?" + GET); yield return www.Send(); if (www.isError) { Debug.Log("Error while downloading: " + www.error); } else { // Show results as text Debug.Log(www.downloadHandler.text); // Or retrieve results as binary data byte[] results = www.downloadHandler.data; } } 

请注意,如果您向info.plist添加NSAppTransportSecurity而没有向Apple提供正确的解释,您的应用可能会被拒绝。 同样,建议您升级服务器并使用https而不是http

Interesting Posts