Support Topics Documentation Slack YouTube Blog

Write error when stayLoggedIn is true in Unity

Backendless Version (3.x / 5.x, Online / Managed / Pro )

6.0

Client SDK (REST / Android / Objective-C / Swift / JS )

Unity : BackendlessSDK-UnityPackage-6.0.0
Android: 10

Application ID

7E819124-27B5-85D2-FF77-9FB70FF33800

Expected Behavior

Set stayLoggedIn=true in Backendless.UserService.LoginAsync should save user login data in the device.
The app have write permissions to storage.

Actual Behavior

I get the following error:

UnauthorizedAccessException: Access to the path "/.config" is denied.
06-25 12:35:45.648 25773 25813 E Unity   :   at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x0004b] in <c79628fadf574d3a8feae0871fad28ef>:0 
06-25 12:35:45.648 25773 25813 E Unity   :   at System.IO.Directory.CreateDirectory (System.String path) [0x00094] in <c79628fadf574d3a8feae0871fad28ef>:0 
06-25 12:35:45.648 25773 25813 E Unity   :   at System.IO.DirectoryInfo.Create () [0x00000] in <c79628fadf574d3a8feae0871fad28ef>:0 
06-25 12:35:45.648 25773 25813 E Unity   :   at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.Create()
06-25 12:35:45.648 25773 25813 E Unity   :   at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00023] in <c79628fadf574d3a8feae0871fad28ef>:0 
06-25 12:35:45.648 25773 25813 E Unity   :   at System.IO.Directory.CreateDirectory (System.String path) [0x00094] in <c79628fadf574d3a8feae0871fad28ef>:0 
06-25 12:35:45.648 25773 25813 E Unity   :   at System.IO.DirectoryInfo.Create () [0x00000] in <c79628fadf574d3a8feae0871fad28ef>:0 
06-25 12:35:45.648 25773 25813 E Unity   :   at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.Create()
06-25 12:35:45.648 25773 25813 E Unity   :   at System.IO.IsolatedStorage.IsolatedStorageFile.PostInit () [0x00035] in <c79628fadf574d3a8feae0871fad28ef>:0 
06-25 12:35:45.648 25773 25813 E Unity   :   at (wrapper remoting-invoke-with-ch

I made some test downloading files to localstorage without error, I think the SDK is trying to write to the root folder.

maybe this will be helpful:

string fileName = "";
#if UNITY_IPHONE			
	string fileNameBase = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/'));
	fileName = fileNameBase.Substring(0, fileNameBase.LastIndexOf('/')) + "/Documents/" + FILE_NAME;
#elif UNITY_ANDROID
	fileName = Application.persistentDataPath + "/" + FILE_NAME ;
#else
	fileName = Application.dataPath + "/" + FILE_NAME;
#endif

fileWriter = File.CreateText(fileName);
fileWriter.WriteLine("Hello world");
fileWriter.Close();

Thank you for reporting this problem, Dario. We are looking into this.

Cheers,
Mark

Hi,

May I know if there is any new information?

Thank you

Hello @Dario_Castaneda

We are working into it. Internal ticket is BKNDLSS-22123. When there will be progress on this issue, we will additionally inform you additionally in this topic.