Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Error about HttpClient

$
0
0

Using HttpClient, I get a message similar to the following
In the case of debugging, the message is not displayed,
In case of release, an error message will be displayed

private async void OnSearchClicked(object sender, EventArgs e)
{
    try
    {

        try
        {

            var uri = new Uri("https://msearch.gsi.go.jp/address-search/AddressSearch?q=" + _Entry1.Text);

            HttpClient myClient = new HttpClient();

            Data.SearchPointList.Clear();

            var response = await myClient.GetAsync(uri);

            if (response.IsSuccessStatusCode)
            {

                var content = await response.Content.ReadAsStringAsync();
                var Items = JsonConvert.DeserializeObject<List<MyArray>>(content);

                double SKDO;
                double SIDO;

                for (int j = 0; j < Items.Count; j++)
                {
                    _ = DisplayAlert("2", "2", "ok");

                    SKDO = Items[j].geometry.coordinates[0];
                    SIDO = Items[j].geometry.coordinates[1];

                    Data.SearchPointList.Add(new Data.SearchPoint(SKDO, SIDO, Items[j].properties.title));
                }
            }

            SearchMapList.ItemsSource = null;
            SearchMapList.ItemsSource = Data.SearchPointList;

        }
        catch(Exception ex)
        {
            _ = DisplayAlert("", ex.Message, "ok");
        }

    }
    catch (Exception)
    {

    }

}


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>