0

Context:

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

lightyears99
  • 101
  • 7
  • 1
    you have to actually post the relevant code if you expect us to help you find an error in it – Jason Sep 25 '21 at 09:06
  • I hope you don't store sensitive info on your `credentials.json` file, anyway, you could _deploy_ the json file when building if you indicate it on your csproj file, see [this similar question](https://stackoverflow.com/questions/48708965/net-core-2-0-appsettings-json-save-on-bin-directory) – Max Sep 25 '21 at 18:13

0 Answers0