您正在使用http下载。目前,Unity将NSAllowsArbitraryLoads添加到Info.plist以简化转换 [英] You are using download over http. Currently Unity adds NSAllowsArbitraryLoads to Info.plist to simplify transition

查看:5631
本文介绍了您正在使用http下载。目前,Unity将NSAllowsArbitraryLoads添加到Info.plist以简化转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

making an app for both iOS and Android with Unity.

我现在遇到了iOS问题:

I'm now stuck on an iOS problem:

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.

不支持的网址

实际问题是:

- 我连接到https地址

- 我确实设置了允许任意负载是

然而,它无效。

这是我的代码:

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 function并且它总是返回上一个错误。

obviously, this is in a IEnumerator function and it ALWAYS returns the previous error.

推荐答案

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

Apple stopped allowing http connections on iOS devices. You can still use http connection by adding NSAppTransportSecurity to the info.plist but this will be removed in the future.It is recommended that you use https connection from now.

  • http://yourdomain.com will give you this error.
  • https://yourdomain.com will NOT give you this error and is what Apple recommends now.

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;
    }
}






请注意,如果您将 NSAppTransportSecurity 添加到 info.plist ,则可能会拒绝您的应用,而无需向Apple提供详细说明。同样,建议您升级服务器并使用 https 而不是 http


Note that your app may be rejected if you add NSAppTransportSecurity to the info.plist without good explanation to Apple. Again, it is recommended that you upgrade your server and use https instead of http.

这篇关于您正在使用http下载。目前,Unity将NSAllowsArbitraryLoads添加到Info.plist以简化转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆