ios 一个未处理的错误已经发生在物理iPhone毛伊岛Blazor

3duebb1j  于 12个月前  发布在  iOS
关注(0)|答案(1)|浏览(100)

我成功地将Maui Blazor安装到iPhone的本地设备(USB电缆),然而,当我点击进入我的应用程序时,我得到了一个错误“发生了一个未处理的错误.错误”.我怎么能看到错误的输出. Im使用Visual Studio 22 for Windows谢谢
我尝试了Chrome://inspect/#devices,但它不显示我的iPhone进行检查。这里是索引中的代码。razor

@if (dataObjects is not null)
        {

            @foreach (var product in dataObjects)
            {
                @if (@product.Sl.HasValue)
                {
                    <tr>
                        <td>Số Lượng: @product.Sl</td>

                    </tr>
                    <tr>
                        <td>Tiền Mặt: @Math.Round(product.TienMat.Value, 2).ToString("n2")</td>

                    </tr>
                    <tr>
                        <td>
                            Thẻ:
                            @if (@product.The.HasValue)
                                @Math.Round(product.The.Value, 2).ToString("n2")

                            </td>

                        </tr>
                    <tr>
                        <td> Lợi Nhuận: @Math.Round(product.LoiNhuan.Value, 2).ToString("n2")</td>
                    </tr>
                }

            }
        }

<button @onclick="OnRefreshClicked">Refresh</button>

@code {
    private List<ThongTinBanHangTrongNgay> dataObjects;
    private HttpClient client;
    private UltiHelps ultiHelps;

    private async Task OnRefreshClicked()
    {
        client = new HttpClient();
        TimeZoneInfo zone = TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time");
        DateTime australianNow = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, zone);
        String TodayDate = australianNow.ToString("yyyy-MM-dd");
        HttpResponseMessage response = await client.GetAsync("XXXXX");
        //string json = await response.Content.ReadAsStringAsync();
        // Khi dữ liệu được trả về, hãy sử dụng phương thức JsonConvert.DeserializeObject() để chuyển đổi dữ liệu JSON thành một đối tượng DataTable
        if (response.IsSuccessStatusCode)
        {
            string json = await response.Content.ReadAsStringAsync();
            dataObjects = JsonConvert.DeserializeObject<List<ThongTinBanHangTrongNgay>>(json);
            //dataObjects._products = JsonSerializer.Deserialize<DataTable>(json);

        }
    }
}

字符串

exdqitrt

exdqitrt1#

我可以重现这个问题。错误应该是“在本地计算机上找不到时区ID 'AUS Eastern Standard Time'”。它只发生在iOS上。
解决方法是,如果Windows时区不起作用,您可以尝试使用IANA时区。
因此,如果您使用澳大利亚/墨尔本澳大利亚/悉尼

TimeZoneInfo zone = TimeZoneInfo.FindSystemTimeZoneById("Australia/Melbourne");

字符串
那就没问题了
有关更多信息,请参阅Converting Microsoft Timezone to standards timezone data in railsHow to translate between Windows and IANA time zones?
希望有帮助!

相关问题