繁体   English   中英

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

[英]You are using download over http. Currently Unity adds NSAllowsArbitraryLoads to Info.plist to simplify transition

使用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.

不受支持的网址

实际问题是:
- 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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM