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.

Hi Vladimir,

Do you have any news?

Hi. Sorry for such a long wait. The task is in the plans for the next iteration.
So, I think the work on it will be started in a two-three days.

Hello @Dario_Castaneda.
I couldn’t reproduce your issue.
Please send me an example of your code that reproduces the error.

Hi Nikita,

var user = await Backendless.UserService.LoginAsync(UserName.text, Password.text, false);

The error is only present in mobile devices, from Unity emulator the error doesn’t occur

Thanks

Hi @Dario_Castaneda, could you send me a simple project where i could reproduce the error?

@Dario_Castaneda, we have fixed this problem and will add it to the SDK package in the near future.

great!

Thank you !

Hello @Dario_Castaneda.
We have updated the nugget package to version 6.0.1 use it.

Regards, Nikita.