SendWebRequest of UnityWebRequest becomes Unknown Error on iOS and does not work

less than 1 minute read

Status

UnityWebRequest, which worked fine on Unity editor, builds and runs on iOS, and SendWebRequest gives an “Unknown Error”.

Cause

I used http for the url.

Solution

1. Allow http

In order to perform http (insecure communication) on iOS, it seems that you have to add the following to Info.plist and allow it.
The solution is to add the following:

<key>NSAppTransportSecurity</key>
<dict>
       <key>NSAllowsArbitraryLoads</key>
       <true/>
       <key>NSExceptionDomains</key>
       <dict>
           <key>just-an-example.com</key>
           <string></string>
       </dict>
</dict>

2. Use https

If you are not particular about http, you can solve it by using https.

reference

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