I have an ASP.Net Core API that is running.
I have a Xamarin Forms solution and in the main project and I have this class:
public class GetSettings
{
public static async Task<SettingResponse> GetSetting()
{
SettingResponse setting = new SettingResponse();
var url = new Uri(string.Format(GetUrl.GenerateURL("GetSetting"), string.Empty));
var client = new HttpClient();
var response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
var result = response.Content.ReadAsStringAsync().Result;
setting = JsonConvert.DeserializeObject<SettingResponse>(result);
}
else
{
setting = null;
}
return setting;
}
}
In the Android and iOS project I have this two lines:
SettingResponse setting = new SettingResponse();
setting = await GetSettings.GetSetting();
In the Android project there is no problem and it works fine, but in the iOS project when getting to new HttpClient(); nothing happens and app does nothing.
