iOS App properly save user credentials in file / appmemory
I am working on an app which makes database and API calls. Therefore, for each API call, I need to send the API-Key within the request as Authentication. Also, I have multiple APIs which are called, so currently I use a credentials.json file which contains the credentials and it’s located inside the project, right next to my classes and interfaces. This works fine on a Console-Application on Windows.
The problems that occur:
When I implement the Library with this Logic in a Xamarin iOS App, i get a System.IO.FileNotFoundException: Could not find file/Users/myname/Library/Developer/CoreSimulator/....
Why cant the app running on iOS not find the file?
How can I make my credentials.json accessible for every device I deploy on?
Which would be the proper way to do this?
The code where I access the file: var credPath = Path.Combine( Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName,"MyDLL/creds.json");