我的 Xamarin IOS应用程序正在崩溃(SIGABRT)。我有一个日志符号报告,但我正在努力解释它。任何帮助将不胜感激:
以下是符号化日志文件的摘录:
Thread 0 name: tid_303 Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000183b0d2ec __pthread_kill + 8
1 libsystem_pthread.dylib 0x0000000183cb26a8 pthread_kill$VARIANT$armv81 + 360
2 libsystem_c.dylib 0x0000000183a7bdb0 __abort + 152
3 libsystem_c.dylib 0x0000000183a7bd18 __abort + 0
4 Caregiver.iOS 0x0000000101fea8a8 xamarin_get_block_descriptor + 4536
5 Caregiver.iOS 0x0000000101f19e98 mono_invoke_unhandled_exception_hook + 19177112 (exception.c:1119)
6 Caregiver.iOS 0x0000000101edaa88 mono_handle_exception_internal + 18918024 (mini-exceptions.c:2080)
7 Caregiver.iOS 0x0000000101ed97d0 mono_handle_exception + 18913232 (mini-exceptions.c:2371)
8 Caregiver.iOS 0x0000000101ed1da4 mono_arm_throw_exception + 18881956 (exceptions-arm64.c:414)
9 Caregiver.iOS 0x0000000100ffcdb8 throw_exception + 168
10 Caregiver.iOS 0x0000000101fea68c xamarin_get_block_descriptor + 3996
11 Caregiver.iOS 0x000000010180ea04 wrapper_native_to_managed_ObjCRuntime_Runtime_throw_ns_exception_intptr + 308
12 CoreFoundation 0x00000001840871c8 __handleUncaughtException + 828
13 libobjc.A.dylib 0x00000001832408c8 _objc_terminate+ 35016 () + 112
14 libc++abi.dylib 0x000000018323137c std::__terminate(void (*)+ 111484 ()) + 16
15 libc++abi.dylib 0x0000000183231400 std::terminate+ 111616 () + 84
16 libdispatch.dylib 0x0000000183978af8 _dispatch_client_callout + 36
17 libdispatch.dylib 0x00000001839b57a8 _dispatch_continuation_pop$VARIANT$armv81 + 416
18 libdispatch.dylib 0x00000001839bec20 _dispatch_source_invoke$VARIANT$armv81 + 1248
19 libdispatch.dylib 0x00000001839b9c44 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 680
20 CoreFoundation 0x000000018402f070 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
21 CoreFoundation 0x000000018402cbc8 __CFRunLoopRun + 2272
22 CoreFoundation 0x0000000183f4cda8 CFRunLoopRunSpecific + 552
23 GraphicsServices 0x0000000185f2f020 GSEventRunModal + 100
24 UIKit 0x000000018df2d78c UIApplicationMain + 236
25 Caregiver.iOS 0x000000010180d6a0 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 368
26 Caregiver.iOS 0x00000001017a5dbc UIKit_UIApplication_Main_string___intptr_intptr + 11361724 (UIApplication.cs:79)
27 Caregiver.iOS 0x00000001017a5d7c UIKit_UIApplication_Main_string___string_string + 11361660 (UIApplication.cs:64)
28 Caregiver.iOS 0x0000000100d0b724 Caregiver_iOS_Application_Main_string__ + 243492 (/<unknown>:1)
29 Caregiver.iOS 0x0000000100fc98c8 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 248
30 Caregiver.iOS 0x0000000101ee8fd0 mono_jit_runtime_invoke + 18976720 (mini-runtime.c:2783)
31 Caregiver.iOS 0x0000000101f50178 mono_runtime_invoke_checked + 19399032 (object.c:2887)
32 Caregiver.iOS 0x0000000101f5537c mono_runtime_exec_main_checked + 19420028 (object.c:0)
33 Caregiver.iOS 0x0000000101ed15b0 mono_jit_exec + 18879920 (driver.g.c:1210)
34 Caregiver.iOS 0x0000000101ff0d14 xamarin_find_protocol_wrapper_type + 25552
35 Caregiver.iOS 0x0000000100cf23e0 main + 140256 (main.m:90)
36 libdyld.dylib 0x00000001839ddfc0 start + 4
代码基本上是一种输入形式,允许用户输入许多文本字段,包括文本选择器,时间选择器和日期选择器。当填写字段时,应用程序会在不同点崩溃。
XAML代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Caregiver.NewItemPage"
Title="{Binding Itemstatus.Title}"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
NavigationPage.HasBackButton="False"
>
<ContentPage.Resources>
<ResourceDictionary>
<OnPlatform x:Key="TitleEnable" x:TypeArguments="x:Boolean" Android="true" iOS="true" WinPhone="false"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.ToolbarItems>
<ToolbarItem Text="Save" Clicked="Save_Clicked" />
<ToolbarItem Text="Cancel" Clicked="Cancel_Clicked" />
</ContentPage.ToolbarItems>
<ContentPage.Content>
<ScrollView>
<StackLayout Spacing="2" Padding="2">
<!-- Link Button -->
<StackLayout Padding="20,0,20,0">
<Grid>
<StackLayout Grid.Row="0" Grid.Column="0">
<Button Text="{Binding Itemstatus.ButTxt} " x:Name="LinkButton" Clicked="OnLinkButtonClicked" TextColor="White" BackgroundColor="Accent"/>
</StackLayout>
</Grid>
</StackLayout>
<!-- Device ID -->
<StackLayout Orientation="Horizontal" >
<StackLayout Orientation="Vertical" >
<StackLayout Padding="10,20,10,10">
<Label x:Name="IDLabel" Text="Device ID(*)" FontSize="Medium" FontAttributes="Bold" TextColor="{Binding Itemstatus.LblColDevice}" />
</StackLayout>
</StackLayout>
<StackLayout Orientation="Vertical" >
<StackLayout Padding="10,20,10,0">
<Label x:Name = "IDText" Text="{Binding Itemstatus.DeviceID}" FontSize="Medium" />
</StackLayout>
</StackLayout>
</StackLayout>
<!-- Participant -->
<StackLayout Orientation="Horizontal" >
<StackLayout Orientation="Vertical" >
<StackLayout Spacing="0" Padding="10">
<Label x:Name = "LblColPtpName" Text="Participant (*) :" FontSize="Medium" FontAttributes="Bold" TextColor="{Binding Itemstatus.LblColPtp}" />
</StackLayout>
</StackLayout>
<StackLayout Orientation="Vertical" >
<Entry x:Name="entryInput" TextChanged="IDEnter_TextChanged" Placeholder="Participant ID Code " Text="{Binding Itemstatus.Text}" FontSize="Medium" />
</StackLayout>
</StackLayout>
<!-- Country -->
<StackLayout Orientation="Horizontal" >
<StackLayout Orientation="Vertical" >
<StackLayout Spacing="0" Padding="10">
<Label x:Name = "NTimezone" Text="Country (*): " FontSize="Medium" FontAttributes="Bold" TextColor="{Binding Itemstatus.LblColTzs}" />
</StackLayout>
</StackLayout>
<StackLayout Orientation="Vertical" >
<Picker Title="Country " x:Name="PickerCtl" SelectedIndexChanged="PickerCtl_OnSelectedIndexChanged">
<Picker.Items>
<x:String>China</x:String>
<x:String>India</x:String>
<x:String>Kenya</x:String>
<x:String>Madagascar</x:String>
<x:String>South Africa</x:String>
<x:String>Uganda</x:String>
<x:String>Vietnam</x:String>
</Picker.Items>
</Picker>
</StackLayout>
</StackLayout>
<!-- Participant Mobile -->
<StackLayout Orientation="Horizontal" >
<StackLayout Orientation="Vertical" >
<StackLayout Spacing="0" Padding="10">
<Label x:Name = "LblColMedTimeName" Text="Medication Time(*):" FontSize="Medium" FontAttributes="Bold" TextColor = "{Binding Itemstatus.LblColMedTime}"/>
</StackLayout>
</StackLayout>
<StackLayout Orientation="Vertical" >
<TimePicker Time="{Binding Itemstatus.MedicationTime}" x:Name="TimeCtl">
</TimePicker>
</StackLayout>
</StackLayout>
<StackLayout Padding="10,5,20,0">
<StackLayout Orientation="Horizontal" >
<StackLayout Orientation="Vertical" >
<StackLayout Spacing="0" Padding="0">
<Label x:Name = "ParMobCol" Text="Participant Mobile:" FontSize="Small" FontAttributes="Bold" WidthRequest="90" TextColor="{Binding Itemstatus.LblColMobileP}" />
</StackLayout>
</StackLayout>
<StackLayout Orientation="Vertical" >
<StackLayout Orientation="Vertical" >
<Picker Title="Area Code" x:Name="PickerCtlIntCodeP" SelectedIndexChanged="PickerCtlIntCodeP_OnSelectedIndexChanged" >
<Picker.Items>
<x:String>(+86)</x:String>
<x:String>(+91)</x:String>
<x:String>(+254)</x:String>
<x:String>(+261)</x:String>
<x:String>(+27)</x:String>
<x:String>(+256)</x:String>
</Picker.Items>
</Picker>
</StackLayout>
</StackLayout>
<StackLayout Orientation="Vertical" >
<Entry x:Name="entryPInput" TextChanged="PEnter_TextChanged" Keyboard="Numeric" Placeholder="Mobile Number" Text="{Binding Itemstatus.PMobile}" FontSize="Medium" WidthRequest="150" />
</StackLayout>
</StackLayout>
</StackLayout>
<!-- Reminder Message -->
<StackLayout Padding="10,10,10,20">
<Label x:Name="ReminderMessage" Text="Reminder Message:" FontSize="Medium" FontAttributes="Bold" />
<Entry x:Name="entryRInput" TextChanged="RemEnter_TextChanged" Placeholder="Please remember to take your Medicine" Text="{Binding Itemstatus.Message}" FontSize="Medium" />
</StackLayout>
<!-- Reminder Options -->
<!-- SMS Reminder - Participant -->
<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
<StackLayout Padding="10,0,10,0">
<Label Text="Send SMS Reminder to Participant " FontSize="Medium"/>
</StackLayout>
</StackLayout>
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
<Switch IsToggled="{Binding Itemstatus.EnableReminderP}"></Switch>
</StackLayout>
</StackLayout>
<!-- SMS Reminder Supporter -->
<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
<StackLayout Padding="10,0,10,0">
<Label Text="Send SMS Reminder to Supporter " FontSize="Medium"/>
</StackLayout>
</StackLayout>
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
<Switch IsToggled="{Binding Itemstatus.EnableReminderC}"></Switch>
</StackLayout>
</StackLayout>
<!-- Enable Alarm on Dispenser -->
<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
<StackLayout Padding="10,0,10,0">
<Label Text="Enable Alarm on Dispenser " FontSize="Medium"/>
</StackLayout>
</StackLayout>
<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
<Switch IsToggled="{Binding Itemstatus.EnableAlarm}"></Switch>
</StackLayout>
</StackLayout>
<!-- Date of Birth -->
<StackLayout Orientation="Horizontal" >
<StackLayout Orientation="Vertical" >
<StackLayout Padding="10,20,0,0">
<Label x:Name = "DOBCol" Text="Date of Birth:" FontSize="Medium" FontAttributes="Bold" TextColor="{Binding Itemstatus.LblColDOB}" />
</StackLayout>
</StackLayout>
<StackLayout Orientation="Vertical" >
<StackLayout Padding="10,10,0,0">
<DatePicker x:Name="DateCtl" Format = "dd MMM yyyy" DateSelected="DatePicker_Changed">
</DatePicker>
</StackLayout>
</StackLayout>
</StackLayout>
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>
我附上了表格的截图: IOS App Entry Form
这是页面代码:
public NewItemPage(NewItemEViewModel viewModel)
{
Item = new Item
{
Id = viewModel.Itemstatus.Id,
Text = viewModel.Itemstatus.Text,
DateOfBirth = viewModel.Itemstatus.DateOfBirth,
Gender = viewModel.Itemstatus.Gender,
DeviceID = viewModel.Itemstatus.DeviceID,
PMobile = viewModel.Itemstatus.PMobile,
CMobile = viewModel.Itemstatus.CMobile,
MedicationTime = viewModel.Itemstatus.MedicationTime,
Message = viewModel.Itemstatus.Message,
EnableAlarm = viewModel.Itemstatus.EnableAlarm,
EnableReminderP = viewModel.Itemstatus.EnableReminderP,
EnableReminderC = viewModel.Itemstatus.EnableReminderC,
TimeZone = viewModel.Itemstatus.TimeZone,
Notes = viewModel.Itemstatus.Notes,
IntCodeP = viewModel.Itemstatus.IntCodeP,
IntCodeC = viewModel.Itemstatus.IntCodeC
};
if (viewModel.Itemstatus.DeviceID == "No Device Linked") viewModel.Itemstatus.ButTxt = "Link Device "; else viewModel.Itemstatus.ButTxt = " Unlink Device ";
InitializeComponent();
BindingContext = this.viewModel = viewModel;
PickerCtl.SelectedIndex = viewModel.Itemstatus.TimezoneIndex;
PickerCtlGender.SelectedIndex = viewModel.Itemstatus.GenderIndex;
PickerCtlIntCodeP.SelectedIndex = viewModel.Itemstatus.IntCodePIndex;
PickerCtlIntCodeC.SelectedIndex = viewModel.Itemstatus.IntCodeCIndex;
DateCtl.Date = viewModel.Itemstatus.DateOfBirth;
DateCtl.MaximumDate = System.DateTime.Now.Date;
}
答案 0 :(得分:0)
在完全尝试所有内容之后,我用项目选择器替换了按钮(开关)。这阻止了应用随机崩溃。
我不确定为什么按钮/开关会导致不稳定。