Я пытаюсь вызвать REST API из моего приложения tvOS. Ниже приведен мой код при нажатии кнопки:
async void ButtonClicked(UIButton sender)
{
try
{
HttpClient client = new HttpClient();
var response = await client.GetAsync("rest api url");
if (response.IsSuccessStatusCode)
{
var Response = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
if (!string.IsNullOrWhiteSpace(Response.ToString()))
{
var category = JsonConvert.DeserializeObject<Videos>(Response.ToString());
Debug.WriteLine("count:>>" + category.webContentCategoryList.Count);
}
}
}
catch(Exception e)
{
Debug.WriteLine("Exception:>>"+e);
}
Я установил пакеты system.net.http
и newtonsoft.json
nuget. Но когда я запускаю проект, приложение показывает Main.cs
файл, как показано на скриншоте ниже:

Am I missing something in this?
UPDATE
I have added breakpoint for the first line inside ButtonClicked
function. When I taps the Button, the application showing Main.cs
file like above screenshot. It is not hitting the first line of ButtonClicked
function.
So the issue is something else, I am not an expert in tvOS applications so I can't figure out. I have uploaded a sample project здесь .