Forum Xamarin.iOS

ModernHttpClient , The network connection was lost, error

I got this error after the app is put on and off flight mode:
: System.Net.WebException: The network connection was lost. --->

Steps to reproduce:
1) Turn on flight mode
2) Turn off flight mode
3) Try to get some data

The error also happen after the app is restored from background, if i has been inactive.

I use ModernHttpClient like this:

var handler = new NativeMessageHandler ();
var client = new HttpClient (handler);
System.Net.Http.HttpResponseMessage responseMsg = await client.GetAsync (url);
responseMsg.EnsureSuccessStatusCode ();
responseBody = responseMsg.Content.ReadAsStringAsync ();
returnvalue = responseBody.Result;

Do someone have the same problem?
Any solution?



Sign In or Register to comment.