1 (edited by nahuel93 2017-11-07 13:46:28)

Topic: iOS access denied when using ClearAllCaches()

I get this error while running an app built for iOS (iPad):
 
  UnauthorizedAccessException: Access to the path "/var/mobile/Containers/Data/Application/CC58E86B-C0FA-4DF5-83F0-5D7D68C61E44/Documents" is denied.

  at System.IO.Directory.Delete (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.Directory.RecursiveDelete (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.Directory.Delete (System.String path, Boolean recursive) [0x00000] in <filename unknown>:0
  at OnlineMapsCache.ClearFileCache () [0x00000] in <filename unknown>:0
  at OnlineMapsCache.ClearAllCaches () [0x00000] in <filename unknown>:0
  at GameManager.Awake () [0x00000] in <filename unknown>:0
 
  (Filename: currently not available on il2cpp Line: -1)

Is there a way to use this functionality in an iOS device? Am I missing something? Nobody had this problem before?

Here's a screenshot of the last few lines in the mentioned GameManager.Awake()

Edit: In android works without problems, this happens only on iOS devices (also tested it in an iPhone 7, same problem)

Edit2: I call that method more than once, in different places, and it doesn't matters where I call it from, it always raises UnauthorizedAccessException

Post's attachments

Attachment icon Screen Shot 2017-11-07 at 9.33.17 AM.png 23.39 kb, 7 downloads since 2017-11-07 

Re: iOS access denied when using ClearAllCaches()

Hello.

Thank you for bug report.
I think the problem is on our side.
We will fix this and release an update within two days.

Kind Regards,
Infinity Code Team

Re: iOS access denied when using ClearAllCaches()

Thanks Alex! If you need more information about my code to help you fix it, please ask.

4 (edited by nahuel93 2017-11-14 12:44:53)

Re: iOS access denied when using ClearAllCaches()

Hi Alex, could you fix this bug? I'm working with online maps version  2.5.16.1, just in case this bug was fixed in a newer version (please let me know if that's the case). We haven't updated version just in case something stops working.

Re: iOS access denied when using ClearAllCaches()

Yes, of course we fixed the bug, and the new version is already available.

In new versions there is nothing scary.
Basically it's bug fixes.

How to fix the problem if you really do not want to update (OnlineMapsCache.cs line: 222):

if (fileCacheLocation == CacheLocation.persistentDataPath) builder.Append(Application.persistentDataPath).Append("\\").Append("OnlineMapsCache");
Kind Regards,
Infinity Code Team

Re: iOS access denied when using ClearAllCaches()

Hi alex, i've just tried the new version. This is now causing this errors in iOS device (ipad2), also related to OnlineMapsCache.

First (appears 4 times in a row, same stacktrace):

UnauthorizedAccessException: Access to the path "/var/mobile/Containers/Data/Application/AC253ABF-8603-44F9-9B3A-DECA180E52B8/Documents\OnlineMapsCache" is denied.
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.DirectoryInfo.Create () [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.DirectoryInfo.Create () [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.DirectoryInfo.Create () [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.DirectoryInfo.Create () [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.DirectoryInfo.Create () [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.DirectoryInfo.Create () [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.DirectoryInfo.Create () [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0
  at OnlineMapsCache+FileCacheAtlas.Add (.OnlineMapsCache cache, .OnlineMapsTile tile, System.Byte[] bytes) [0x00000] in <filename unknown>:0
  at OnlineMapsCache.AddFileCacheItem (.OnlineMapsTile tile, System.Byte[] bytes) [0x00000] in <filename unknown>:0
  at OnlineMapsCache.OnTileDownloaded (.OnlineMapsTile tile) [0x00000] in <filename unknown>:0
  at OnlineMaps.OnTileWWWComplete (.OnlineMapsWWW www) [0x00000] in <filename unknown>:0
  at OnlineMapsWWW.Finish () [0x00000] in <filename unknown>:0
  at OnlineMapsWWW+<WaitResponse>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
  at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0

Second:

NullReferenceException
  at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00000] in <filename unknown>:0
  at OnlineMapsTileSetControl.InitMapSubMeshTriangles (UnityEngine.Material[]& materials, Int32 x, Int32 y, Int32 w, Int32 h, Int32 subMeshVX, Int32 subMeshVZ, UnityEngine.Shader tileShader) [0x00000] in <filename unknown>:0
  at OnlineMapsTileSetControl.InitMapMesh () [0x00000] in <filename unknown>:0
  at OnlineMapsTileSetControl.OnAwakeBefore () [0x00000] in <filename unknown>:0
  at OnlineMaps.Awake () [0x00000] in <filename unknown>:0

And finally:

UnauthorizedAccessException: Access to the path "/var/mobile/Containers/Data/Application/AC253ABF-8603-44F9-9B3A-DECA180E52B8/Documents\OnlineMapsCache" is denied.
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0
  at OnlineMapsCache+FileCacheAtlas.Save (.OnlineMapsCache cache) [0x00000] in <filename unknown>:0
  at OnlineMapsCache.OnDisable () [0x00000] in <filename unknown>:0
UnityEngine.GameObject:SetActive(Boolean)

After this last error, the game crashes (quits unexpectedly). Any thoughts on this? Thanks for your time

Re: iOS access denied when using ClearAllCaches()

1, 3. Try this (OnlineMapsCache.cs line: 222):

if (fileCacheLocation == CacheLocation.persistentDataPath) builder.Append(Application.persistentDataPath).Append("/").Append("OnlineMapsCache");

2. Please make sure that all the shaders used are in the build.

Kind Regards,
Infinity Code Team

8 (edited by nahuel93 2017-11-21 19:58:57)

Re: iOS access denied when using ClearAllCaches()

I tried your suggestion and replaced the line of code, and now this 2 errors occur when running the game.

First:
NotImplementedException: The requested feature is not implemented.
  at OnlineMapsControlBase.GetCoords (System.Double& lng, System.Double& lat, Vector2 position) [0x00000] in <filename unknown>:0
  at OnlineMapsControlBase.ZoomOnPoint (Int32 zoomOffset, Vector2 screenPosition) [0x00000] in <filename unknown>:0
  at OnlineMapsControlBase.UpdateGestureZoom () [0x00000] in <filename unknown>:0
  at OnlineMapsControlBase.Update () [0x00000] in <filename unknown>:0

Second:
NullReferenceException
  at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00000] in <filename unknown>:0
  at OnlineMapsTileSetControl.InitMapSubMeshTriangles (UnityEngine.Material[]& materials, Int32 x, Int32 y, Int32 w, Int32 h, Int32 subMeshVX, Int32 subMeshVZ, UnityEngine.Shader tileShader) [0x00000] in <filename unknown>:0
  at OnlineMapsTileSetControl.InitMapMesh () [0x00000] in <filename unknown>:0
  at OnlineMapsTileSetControl.OnAwakeBefore () [0x00000] in <filename unknown>:0
  at OnlineMaps.Awake () [0x00000] in <filename unknown>:0

There's a problem with some shader but I don't know what shader it's talking about. How can I make sure that all the shaders used are in the build? Which shaders are you talking about in your answer? The game still crashes a few seconds after the second error raises

Re: iOS access denied when using ClearAllCaches()

1. This is a very unexpected exception.
I just checked it and ... it's implemented.
If possible, please send your scene (as a package) to us in support (support@infinity-code.com). I very-very want to see how this is possible.

2. Open "Online Maps Tileset Control / Materials & Shaders" and make sure you use all shader fields.
Perhaps you (asset) have lost some reference.

Kind Regards,
Infinity Code Team