Met error: ArgumentNullException: Value cannot be null.
I have a code: public IEnumerator Download(ResourceModel model,List urls) {
for(int i=0; i< urls.Count; i++)
{
Debug.Log(urls[i]);
using (UnityWebRequest www = UnityWebRequest.Get(urls[i]))
{
StartCoroutine(ShowProgress(www, model.data[i].dataName));
yield return www.SendWebRequest();
string path = Path.Combine(Application.persistentDataPath, model.data[i].dataName);
Debug.Log(path);
File.WriteAllBytes(path, www.downloadHandler.data);
}
}
}
IEnumerator ShowProgress(UnityWebRequest www, string fileName)
{
_downloadInfoTxt.text = "downloading " + fileName + " file ...";
while (!www.isDone)
{
_loadingBar.fillAmount = www.downloadProgress;
_percenTxt.text = Mathf.RoundToInt(www.downloadProgress * 100) + "%";
Debug.Log("Downloaded: " + www.downloadProgress * 100);
Debug.Log("is Done: " + www.isDone);
yield return new WaitForEndOfFrame();
}
Debug.Log("=====>> da ra ngoai roi");
_loadingBar.fillAmount = 1;
_percenTxt.text = "100%";
_downloadInfoTxt.text = "The " + fileName + " file dowload is completed.";
}
When i call download IENumrator it work in Unity Editor, but i met the error when run on iOS.
Uploading Crash Report ArgumentNullException: Value cannot be null. Parameter name: unity_self at LoadingView+d_9.MoveNext () [0x00000] in :0 at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in :0
(Filename: currently not available on il2cpp Line: -1)
This method to show download progress and saves the file to a folder.
Please, tell me why I met the error and how to fix it. Thanks.
Answer by DevDeveloperDev · Nov 07, 2020 at 03:35 PM
I will randomly get the same error. Any fix for this?
Your answer

Follow this Question
Related Questions
How to get the Progress from a IEnumerator 0 Answers
Get Debug.Log output in the working iOS build 5 Answers
UIButton not working when testing on mobile device 0 Answers
Get single axis from gyroscopic input (iOS) 0 Answers
Is the Pro license enough to remove the splash screen and build the game to iOS and Android? 2 Answers