Hello people, Im getting a error when I try to copy a file from StreamingAssets `Application.dataPath` to `Application.persistentDataPath`
On android works fine, but on IOS im getting this error:
*App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Use HTTPS instead or add Exception Domains to your app's Info.plist.
*Cannot start load of Task .<2> since it does not conform to ATS policy
*Task .<2> finished with error [-1022] Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., NSErrorFailingURLStringKey=http://localhost/private/var/containers/Bundle/Application/XXXXXXX/AppnName/Data/Raw/xlsx/puestaapunto.xlsx, NSErrorFailingURLKey=http://localhost/private/var/containers/Bundle/Application/XXXXXXX/AppnName/Data/Raw/xlsx/puestaapunto.xlsx, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask .<2>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask .<2>, NSUnderlyingError=0x280b88a80 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}}
this Is the code:
#if UNITY_IOS
string oriPath = Path.Combine(Application.dataPath + "/Raw/xlsx/", "puestaapunto.xlsx"); //returns a DirectoryInfo object
#endif
UnityWebRequest reader = UnityWebRequest.Get(oriPath);
reader.SendWebRequest();
while (!reader.isDone) { }
realPath = Application.persistentDataPath + "/xlsx/" + "puestaapunto2.xlsx"; //save the file with this name
File.WriteAllBytes(realPath, reader.downloadHandler.data);
Debug.Log("Excel File generated in app data from StreamingAssets");
//FillExcelFile();
//SendEmail();
}
any guidance?, thanks
↧