- Home /
Question by
VARtechLLC · Jan 16, 2018 at 04:31 AM ·
ioswebrequestpostformaddfield
WebRequest Post empty on iOS
I am performing a simple UnityWebRequest.Post, it works perfectly fine on PC and Android but not on iOS both in the editor and on the iOS device. Even with hard coded values, the WWWForm that is being sent to the PHP page is still null or empty. Again this is only a problem on iOS. Any ideas?
WWWForm Leaderboard= new WWWForm();
Leaderboard.AddField("score", highscore);
yield return new WaitForEndOfFrame();
using (UnityWebRequest www = UnityWebRequest.Post(score_PHP, Leaderboard))
{
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
Debug.Log("Success!: " + www.downloadHandler.text;
}
}
Comment
Best Answer
Answer by VARtechLLC · Jan 18, 2018 at 05:15 PM
For those who have the same problem I did, Unity provided me with the solution. Currently there is an issue with UnityWebRequest on iOS, the workaround is to use chunkedTransfer = false. That solved my problem.
using (UnityWebRequest www = UnityWebRequest.Post(score_PHP, Leaderboard))
{
www.chunkedTransfer = false;
yield return www.SendWebRequest();