Sending Xamarin forms iOS app to the background crashes.

Kam M 31 Reputation points
2023-02-13T06:01:07.12+00:00

Hi,

I get the following crash when I switch between applications / sending my application to the background.

On the form, I have Grid, Scroll view, TableView.

I appreciate your help and advice.

Thanks.

Kamal

at Xamarin.Forms.Platform.iOS.CheckBoxRendererBase`1[T].LayoutSubviews () [0x0000c] in <ff8f12b789024a7b92ed1e7ad7f7705e>:0 
  at (wrapper managed-to-native) UIKit.UIApplication.xamarin_UIApplicationMain(int,string[],intptr,intptr,intptr&)
  at UIKit.UIApplication.UIApplicationMain (System.Int32 argc, System.String[] argv, System.IntPtr principalClassName, System.IntPtr delegateClassName) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/src/Xamarin.iOS/UIKit/UIApplication.cs:57 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00013] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.1.1.27/src/Xamarin.iOS/UIKit/UIApplication.cs:82 
  at Tingle.iOS.Application.Main (System.String[] args) [0x00001] in /Users/kamalmostofi/Dev/Tingle/Tingle.iOS/Main.cs:17 

Update
The device OS is the latest version 16.2, Xamarin Forms version is 5.0.0.2545, VS is 17.4.4 Build 12 for MAC, Xcode version is 14.2

Thank you.

 <StackLayout Margin="20,10,20,10" Padding="20" 
                            Orientation="Vertical"
                            VerticalOptions="FillAndExpand">

                               <TableView HeightRequest="1100"
                                    Margin="{StaticResource marginThicknessAll10}"
                                    HasUnevenRows="True"
                                    Intent="Form" HorizontalOptions="FillAndExpand"
                                    VerticalOptions="FillAndExpand">
                                    <TableRoot>
                                        <TableSection Title="{artina:Translate MembershipOption}">
                                            <ViewCell>
                                                 <Picker
                                                        x:Name="AccountTypePicker" 
                                                        BackgroundColor="{StaticResource BasePageColor}"
                                                        HorizontalOptions="FillAndExpand"
                                                        SelectedIndexChanged="AccountTypePicker_SelectedIndexChanged"
                                                        ItemDisplayBinding="{Binding Name}"
                                                        Style="{StaticResource PickerStyle}">
                                                             <Picker.WidthRequest>
                                                   <OnIdiom x:TypeArguments="x:Double">
                                                      <OnIdiom.Phone>180</OnIdiom.Phone>
                                                       <OnIdiom.Tablet>280</OnIdiom.Tablet>
                                                    </OnIdiom>
                                                </Picker.WidthRequest>
                                                <Picker.HeightRequest>
                                                   <OnIdiom x:TypeArguments="x:Double">
                                                      <OnIdiom.Phone>50</OnIdiom.Phone>
                                                       <OnIdiom.Tablet>70</OnIdiom.Tablet>
                                                    </OnIdiom>
                                                </Picker.HeightRequest>
                       
                                                <Picker.FontSize>
                                                     <OnIdiom x:TypeArguments="x:Double">
                                                      <OnIdiom.Phone>16</OnIdiom.Phone>
                                                       <OnIdiom.Tablet>24</OnIdiom.Tablet>
                                                    </OnIdiom>
                                                </Picker.FontSize>
                                                </Picker>
                                            </ViewCell>
                                        </TableSection>
                                        <TableSection Title="Relationship Preferences">
                                            <ViewCell>
                                                 <StackLayout
                                                            x:Name="filterOptions"
                                                            Margin="10,5,10,2"
                                                            Orientation="Vertical">
                                        
                                                            <StackLayout HorizontalOptions="Start" Orientation="Horizontal">
                                                                <CheckBox
                                                                    x:Name="chkSerious"
                                                                    CheckedChanged="chkSerious_CheckedChanged"
                                                                    HorizontalOptions="Start" IsChecked="False" 
                                                                    VerticalOptions="CenterAndExpand"
                                                                    Color="{StaticResource AccentColor}" >
                                                                     <CheckBox.HeightRequest>
                                                                    <OnIdiom x:TypeArguments="x:Double">
                                                                        <OnIdiom.Phone>30</OnIdiom.Phone>
                                                                        <OnIdiom.Tablet>50</OnIdiom.Tablet>
                                                                    </OnIdiom>
                                                                </CheckBox.HeightRequest>
                                                                 <CheckBox.WidthRequest>
                                                                    <OnIdiom x:TypeArguments="x:Double">
                                                                        <OnIdiom.Phone>50</OnIdiom.Phone>
                                                                        <OnIdiom.Tablet>70</OnIdiom.Tablet>
                                                                    </OnIdiom>
                                                                </CheckBox.WidthRequest>

                                                                </CheckBox>
                                                                <Label
                                                                    HorizontalOptions="Start"
                                                                    Text="Long Term"
                                                                    VerticalOptions="CenterAndExpand" >
                                                                      <Label.FontSize>
                                                                        <OnIdiom x:TypeArguments="x:Double">
                                                                            <OnIdiom.Phone>16</OnIdiom.Phone>
                                                                            <OnIdiom.Tablet>22</OnIdiom.Tablet>
                                                                        </OnIdiom>
                                                                    </Label.FontSize>

                                                                </Label>
                                                            </StackLayout>
                                                            <StackLayout HorizontalOptions="Start" Orientation="Horizontal">
                                                                <CheckBox
                                                                    x:Name="chkCasual"
                                                                  CheckedChanged="chkCasual_CheckedChanged"
                                                
                                                                    HorizontalOptions="Start"
                                                                    VerticalOptions="CenterAndExpand"
                                                
                                                                    Color="{StaticResource AccentColor}" >
                                                                     <CheckBox.HeightRequest>
                                                                    <OnIdiom x:TypeArguments="x:Double">
                                                                        <OnIdiom.Phone>30</OnIdiom.Phone>
                                                                        <OnIdiom.Tablet>50</OnIdiom.Tablet>
                                                                    </OnIdiom>
                                                                </CheckBox.HeightRequest>
                                                                 <CheckBox.WidthRequest>
                                                                    <OnIdiom x:TypeArguments="x:Double">
                                                                        <OnIdiom.Phone>50</OnIdiom.Phone>
                                                                        <OnIdiom.Tablet>70</OnIdiom.Tablet>
                                                                    </OnIdiom>
                                                                </CheckBox.WidthRequest>

                                                                </CheckBox>
                                                                <Label
                                                                    HorizontalOptions="Start"
                                                                    Text="{artina:Translate Casual}"
                                                                    VerticalOptions="CenterAndExpand" >
                                                                      <Label.FontSize>
                                                                        <OnIdiom x:TypeArguments="x:Double">
                                                                            <OnIdiom.Phone>16</OnIdiom.Phone>
                                                                            <OnIdiom.Tablet>22</OnIdiom.Tablet>
                                                                        </OnIdiom>
                                                                    </Label.FontSize>

                                                                </Label>
                                                            </StackLayout>
                                                            <StackLayout HorizontalOptions="Start" Orientation="Horizontal">
                                                                <CheckBox
                                                                    x:Name="chkCompanion"
                                                                   CheckedChanged="chkCompanion_CheckedChanged"
                                                                    HorizontalOptions="Start"
                                                                    VerticalOptions="CenterAndExpand"
                                                                    Color="{StaticResource AccentColor}" >
                                                                     <CheckBox.HeightRequest>
                                                                    <OnIdiom x:TypeArguments="x:Double">
                                                                        <OnIdiom.Phone>30</OnIdiom.Phone>
                                                                        <OnIdiom.Tablet>50</OnIdiom.Tablet>
                                                                    </OnIdiom>
                                                                </CheckBox.HeightRequest>
                                                                 <CheckBox.WidthRequest>
                                                                    <OnIdiom x:TypeArguments="x:Double">
                                                                        <OnIdiom.Phone>50</OnIdiom.Phone>
                                                                        <OnIdiom.Tablet>70</OnIdiom.Tablet>
                                                                    </OnIdiom>
                                                                </CheckBox.WidthRequest>

                                                                </CheckBox>
                                                                <Label
                                                                    HorizontalOptions="Start"
                                                                    Text="{artina:Translate Companion}"
                                                                    VerticalOptions="CenterAndExpand" >
                                                                      <Label.FontSize>
                                                                        <OnIdiom x:TypeArguments="x:Double">
                                                                            <OnIdiom.Phone>16</OnIdiom.Phone>
                                                                            <OnIdiom.Tablet>22</OnIdiom.Tablet>
                                                                        </OnIdiom>
                                                                    </Label.FontSize>

                                                                </Label>
                                                            </StackLayout>
                                                    </StackLayout>
                                            </ViewCell>
                                        </TableSection>
                                        <TableSection Title="Select one or more options">
                                            <ViewCell>
                                                   <ListView
                                                        x:Name="lstRelationType" MinimumHeightRequest="180" HeightRequest="250"
                                                        VerticalOptions="FillAndExpand" BackgroundColor="{StaticResource BasePageColor}">
                                                        <ListView.ItemTemplate>
                                                            <DataTemplate>
                                                                <ViewCell>
                                                                    <StackLayout Margin="10,0,0,5" HorizontalOptions="FillAndExpand"
                                                                                 Orientation="Horizontal" >
                                                                        <CheckBox
                                                                            x:Name="chkRelationType"
                                                                            HorizontalOptions="Start"
                                                                            IsChecked="{Binding isChecked}"
                                                                            VerticalOptions="CenterAndExpand"
                                                                            Color="{StaticResource AccentColor}" >
                                                                             <CheckBox.HeightRequest>
                                                                                <OnIdiom x:TypeArguments="x:Double">
                                                                                    <OnIdiom.Phone>50</OnIdiom.Phone>
                                                                                    <OnIdiom.Tablet>70</OnIdiom.Tablet>
                                                                                </OnIdiom>
                                                                            </CheckBox.HeightRequest>
                                                                             <CheckBox.WidthRequest>
                                                                                <OnIdiom x:TypeArguments="x:Double">
                                                                                    <OnIdiom.Phone>50</OnIdiom.Phone>
                                                                                    <OnIdiom.Tablet>70</OnIdiom.Tablet>
                                                                                </OnIdiom>
                                                                            </CheckBox.WidthRequest>

                                                                        </CheckBox>
                                                                        <Label
                                                                            HorizontalOptions="Start"
                                                                            Text="{Binding Name}"
                                                                            VerticalOptions="CenterAndExpand" >
                                                                              <Label.FontSize>
                                                                                <OnIdiom x:TypeArguments="x:Double">
                                                                                    <OnIdiom.Phone>16</OnIdiom.Phone>
                                                                                    <OnIdiom.Tablet>22</OnIdiom.Tablet>
                                                                                </OnIdiom>
                                                                            </Label.FontSize>

                                                                        </Label>

                                                                    </StackLayout>
                                                   
                                                                </ViewCell>
                                                            </DataTemplate>
                                                        </ListView.ItemTemplate>
                                                    </ListView>
                                            </ViewCell>
                                        </TableSection>

 </TableRoot>
                               </TableView>
                          
                            </StackLayout>
Developer technologies | .NET | Xamarin
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.