question

MaxHoughton-8994 avatar image
0 Votes"
MaxHoughton-8994 asked ·

Xamarin.iOS AppDelegate HTTP Calls

I'm using a HttpClient within a data service class to perform HTTP requests. This service is registered with dependency injection (using Autofac) and I create an instance of this service using DI in the AppDelegate FinishedLaunching method. When I try and make any calls using the data service the request takes over 30 seconds then times out every time. Is there a reason I can't do HTTP requests in the FinishedLoading method?

dotnet-xamarinforms
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

If you want to access a http request , you need to add AppTransportSecurity in info.plist

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>yourserver.com</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow HTTP requests-->
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
    </dict>
  </dict>
</dict>
0 Votes 0 ·

0 Answers