Below is my Code
try
{
var json = JsonConvert.SerializeObject(dtr);
var content = new StringContent(json, Encoding.UTF8, "application/json");
//This line below works on android but not on ios 14 devices , no exception return , nothing happened.
var response = await client.PostAsync("edtrapi/api/edtr", content);
string res = await response.Content.ReadAsStringAsync();
return Convert.ToInt32(res);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message.ToString());
return 0;
}
I guesss you are testing with
Http
request.Actually from
iOS9
,Http
request is not allowed by default, since it is not safe,Https
is the recommeded way .To enable
Http
, you can setATS
in info.plist .Or add exceptions for specific domains .
Refer to https://stackoverflow.com/a/35884843/8187800 .