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/....

My Questions:

  1. Why cant the app running on iOS not find the file?

  2. How can I make my credentials.json accessible for every device I deploy on?

  3. 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");

Source: Xamarin.ios Questions

Categorised as Uncategorised Tagged , , , ,


Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us