Erik Jigvall
Erik Jigvall

Reputation: 11

GetFileAsync not working downloading from storage in Unity, built on iOS

I've been having a pretty irritating problem when using storage with unity 2018.1.6 and building to iOS 11. To download the files I am using GetFileAsync to persistentDataPath and it downloads but when it is supposed to be finished an error occurs: StorageException: An unknown error occurred.

I've checked if it has to do with read/write but haven't found any answers to that. It works downloading only to RAM and having the files temporary but I really need to save them on the local storage. I've checked the file path, directory existing, file existing, different file (.jpg insted of octet-stream), it works on windows and mac but not on iOS... This is really getting annoying as it feels like I'm not getting anywhere and really need to be done on friday. If any more information is wanted please ask, thanks in advance!

Upvotes: 0

Views: 1249

Answers (2)

Erik Jigvall
Erik Jigvall

Reputation: 11

I found the problem by asking firebase support, they really helped me with the problem and sent me an example code here. Specifically what solved the problem was the functions PathToPersistentDataPathUriString and the FileUriStringToPath. I leave this here for any other developer that needs help with this issue as I had.

Upvotes: 1

NeoShaman
NeoShaman

Reputation: 83

The link in Erik's answer is broken. If anyone else is looking for a solution, here is what worked for me:

I appended "file://" to the destinationFilePath passed to GetFileAsync.

Upvotes: 1

Related Questions