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

查看:51
本文介绍了您正在使用通过 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 地址
- 我确实将 Allow Arbitrary Loads 设置为 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 函数中,它总是返回上一个错误.

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

推荐答案

Apple 停止允许 iOS 设备上的 http 连接.您仍然可以通过在 info.plist 中添加 NSAppTransportSecurity 来使用 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天全站免登陆