iOS上UnityWebRequest的SendWebRequest变为Unknown Error,并且不起作用


状态

在Unity编辑器上运行良好的UnityWebRequest在iOS上构建和执行后,在SendWebRequest中变为"未知错误"。

原因

我将http用作

网址。

解决方案

1.允许http

为了在iOS上执行http(不安全通信),似乎您必须将以下内容添加到Info.plist并允许它。
解决方案是添加以下内容:

1
2
3
4
5
6
7
8
9
10
<key>NSAppTransportSecurity</key>
<dict>
       <key>NSAllowsArbitraryLoads</key>
       <true/>
       <key>NSExceptionDomains</key>
       <dict>
           <key>just-an-example.com</key>
           <string></string>
       </dict>
</dict>

2.使用https

如果您不太了解

http,则可以使用https解决。

参考

https://stackoverrun.com/ja/q/11035750