在iOS中发布.Net Maui应用程序时出现严重错误

c0vxltue  于 2023-07-01  发布在  iOS
关注(0)|答案(1)|浏览(213)

我在商店里发布了.Net毛伊岛应用程序。在Android是所有的罚款,但我有一个严重的错误,在应用程序商店.我在iOS的调试模式下测试了我的应用程序,它很好,没有问题。但是当我在商店里发布应用程序时,它崩溃了。
在我的应用程序中有很多具有类似功能的页面,所以我不明白这个问题。在这个页面中,我有一个列表视图,如代码所示:

List<ModelClass> GeneralDBClassResult = new List<ModelClass>();
string companyCode = "";

        public Page(List<ModelClass> fgdbc, string cCode)
        {
            InitializeComponent();

            LoadComponents(fgdbc, cCode);
        }

        private async void LoadComponents(List<ModelClass> fgdbc, string cCode)
        {
            try
            {
                companyCode = cCode;
                ThisPage.Title = cCode;

                if (fgdbc != null)
                {
                    GeneralDBClassResult = fgdbc;
                    listView.ItemsSource = fgdbc.Where(c => c.Id >= 0).Where(c => c.Contact_Code == cCode).OrderByDescending(c => c.Samples_Date).GroupBy(c => c.Samples_Date.Year);
                }
            }
            catch (Exception ex)
            {
                connetionDBClass.PublicErrorInDB(ex.ToString());
            }
        }

这是我在XAML中的列表视图:

<ListView Grid.Row="1" x:Name="listView" IsGroupingEnabled="True" ItemSelected="listView_ItemSelected" IsPullToRefreshEnabled="False" GroupDisplayBinding="{Binding Key}" GroupShortNameBinding="{Binding Key}">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <ViewCell.View>
                                <Grid RowDefinitions="*,*,*,*" ColumnDefinitions="auto,*,*" Padding="5">

                                    ...

                                </Grid>
                            </ViewCell.View>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

我得到的,是一个错误,当我试图添加项目的列表视图在这一行
listView.ItemsSource = fgdbc.Where(c => c.Id >= 0).Where(c => c.Contact_Code == cCode).OrderByDescending(c => c.Samples_Date).GroupBy(c => c.Samples_Date.Year);
这是我得到的错误:

ObjCRuntime.ObjCException: Objective-C exception thrown.  
Name: NSInvalidArgumentException Reason: *** -[__NSPlaceholderArray initWithObjects:count:]: 
attempt to insert nil object from 

objects[0]Native stack trace:   0   CoreFoundation 
                     
0x0000000192cb4cc0 4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 40128 1   libobjc.A.dylib   
0x000000018bd543d0 objc_exception_throw + 60    2   CoreFoundation  
0x0000000192e5af84 4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 1769348
3   CoreFoundation                      
0x0000000192e579c4 4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 1755588   4   CoreFoundation    
0x0000000192cb00a8 4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 20648 5   CoreFoundation                      
0x0000000192cb139c 4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 25500 6   AppName                  
0x0000000106e0bfc8 xamarin_release_block_on_main_thread + 12148 7   AppName                  
0x0000000107110f88 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 2441380   8   AppName                  0x000000010711828c 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 2470824   9   UIKitCore                           0x0000000194d72b98 B3834960-244B-34E4-9EA0-
CA4BB44EF0F3 + 363416   10  UIKitCore                           0x0000000194d714b8 B3834960-244B-
34E4-9EA0-CA4BB44EF0F3 + 357560 11  AppName                  0x0000000106e11640 xamarin_log + 6816  
12  AppName                  0x00000001051544e8 
_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 34530836 
13  AppName                  0x0000000106cae418 
_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 63210820 
14  AppName                  0x00000001049a4684 
_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 26470320 
15  AppName                  0x000000010477fdf0 
_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 24223516 
16  AppName                  0x0000000105244a8c 
_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 35515320 
17  AppName                  0x0000000107078fa0 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1818812   18  AppName                  0x0000000106fcf488 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1123748   19  AppName                  0x0000000106fd11d0 

_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1131244   20  AppName                  0x00000001070e7b9c _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 2272440   21  AppName                  0x00000001070ef1e8 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 2302724   22  Foundation                          0x000000018cfa47ac 6E76DC96-11AF-3B2E-B71E-
215F9CC6E822 + 243628   23  CoreFoundation                      0x0000000192d7e128 4230C122-42E8-
383B-BEEC-EE7B61F8BB61 + 864552 24  CoreFoundation                      0x0000000192d8a7b4 4230C122-
42E8-383B-BEEC-EE7B61F8BB61 + 915380    25  CoreFoundation                      0x0000000192d0f5e8 
4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 411112   26  CoreFoundation                      
0x0000000192d250d4 4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 499924    27  CoreFoundation                      
0x0000000192d2a3ec CFRunLoopRunSpecific + 612   28  GraphicsServices                    
0x00000001ce1ef35c GSEventRunModal + 164    29  UIKitCore                           
0x00000001950b76e8 B3834960-244B-34E4-9EA0-CA4BB44EF0F3 + 3790568   30  UIKitCore                           
0x00000001950b734c UIApplicationMain + 340  31  AppName                  0x0000000106e05bb0 
xamarin_UIApplicationMain + 24  32  AppName                  0x000000010514e5a0 
_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 34506444 
33  AppName                  0x0000000106c94738 
_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 63105124 

34  AppName                  0x0000000107078fa0 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1818812   35  AppName                  0x0000000106fcdbd8 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1117428   36  AppName                  0x0000000106fd4264 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1143680   37  AppName                  0x000000010707df40 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1839196   38  AppName                  0x0000000106e10e10 xamarin_log + 4720  39  AppName                  
0x00000001070e2d2c 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 2252360   40  dyld                                0x00000001b222adec 8A423F3F-B318-315E-99C7-
05EE532E9C0D + 89580   at UIKit.UITableView.ReloadSectionIndexTitles()   at 
Microsoft.Maui.Controls.Handlers.Compatibility.ListViewRenderer.ListViewDataSource.OnShortNamesColle
ctionChanged(Object sender, NotifyCollectionChangedEventArgs e)   at 
Microsoft.Maui.Controls.Internals.TemplatedItemsList`2.ShortNamesProxy[[Microsoft.Maui.Controls.Item
sView`1[[Microsoft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null]], Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null],[Microsoft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=null]].OnCollectionChanged(NotifyCollectionChangedEventArgs e)   at 
Microsoft.Maui.Controls.Internals.TemplatedItemsList`2.ShortNamesProxy[[Microsoft.Maui.Controls.Item
sView`1[[Microsoft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null]], Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null],[Microsoft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=null]].OnItemsListCollectionChanged(Object sender, 
NotifyCollectionChangedEventArgs e)   at 
Microsoft.Maui.Controls.Internals.TemplatedItemsList`2[[Microsoft.Maui.Controls.ItemsView`1[[Microso
ft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null]], Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null],[Microsoft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=null]].OnCollectionChanged(NotifyCollectionChangedEventArgs e)   at 

Microsoft.Maui.Controls.Internals.TemplatedItemsList`2[[Microsoft.Maui.Controls.ItemsView`1[[Microso
ft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null]], Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null],[Microsoft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, 

Culture=neutral, PublicKeyToken=null]].GroupedReset()   at 
Microsoft.Maui.Controls.Internals.TemplatedItemsList`2[[Microsoft.Maui.Controls.ItemsView`1[[Microso
ft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null]], Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 

PublicKeyToken=null],[Microsoft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=null]].OnCollectionChangedGrouped(NotifyCollectionChangedEventArgs 
e)   at 
Microsoft.Maui.Controls.Internals.TemplatedItemsList`2[[Microsoft.Maui.Controls.ItemsView`1[[Microso

ft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null]], Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null],[Microsoft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=null]].OnProxyCollectionChanged(Object sender, 
NotifyCollectionChangedEventArgs e)   at 
Microsoft.Maui.Controls.Internals.TemplatedItemsList`2[[Microsoft.Maui.Controls.ItemsView`1[[Microso
ft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null]], Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null],[Microsoft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=null]].OnItemsSourceChanged(Boolean fromGrouping)   at 
Microsoft.Maui.Controls.Internals.TemplatedItemsList`2[[Microsoft.Maui.Controls.ItemsView`1[[Microso
ft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=null]], Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, 

PublicKeyToken=null],[Microsoft.Maui.Controls.Cell, Microsoft.Maui.Controls, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=null]].BindableOnPropertyChanged(Object sender, 
PropertyChangedEventArgs e)   at Microsoft.Maui.Controls.BindableObject.OnPropertyChanged(String 
propertyName)   at Microsoft.Maui.Controls.Element.OnPropertyChanged(String propertyName)   at 
Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, 

BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, 

Boolean silent)   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, 
Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)   at 
Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value, Boolean 
fromStyle, Boolean checkAccess)   at 
Microsoft.Maui.Controls.ItemsView`1[[Microsoft.Maui.Controls.Cell, Microsoft.Maui.Controls, 
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].set_ItemsSource(IEnumerable value)   at 

AppName.Page.LoadComponents(List`1 fgdbc, String cCode)Native stack trace:  0   CoreFoundation                      
0x0000000192cb4cc0 4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 40128 1   libobjc.A.dylib                     
0x000000018bd543d0 objc_exception_throw + 60    2   CoreFoundation                      
0x0000000192e5af84 4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 1769348   3   CoreFoundation                      
0x0000000192e579c4 4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 1755588   4   CoreFoundation                      
0x0000000192cb00a8 4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 20648 5   CoreFoundation                      

0x0000000192cb139c 4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 25500 6   AppName                  
0x0000000106e0bfc8 xamarin_release_block_on_main_thread + 12148 7   AppName                  
0x0000000107110f88 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 2441380   8   AppName                  0x000000010711828c 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 2470824   9   UIKitCore                           0x0000000194d72b98 B3834960-244B-34E4-9EA0-
CA4BB44EF0F3 + 363416   10  UIKitCore                           0x0000000194d714b8 B3834960-244B-
34E4-9EA0-CA4BB44EF0F3 + 357560 11  AppName                  0x0000000106e11640 xamarin_log + 6816  
12  AppName                  0x00000001051544e8 

_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 34530836 

13  AppName                  0x0000000106cae418 
_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 63210820 
14  AppName                  0x00000001049a4684 
_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 26470320 

15  AppName                  0x000000010477fdf0 
_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 24223516 
16  AppName                  0x0000000105244a8c 
_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 35515320 
17  AppName                  0x0000000107078fa0 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1818812   18  AppName                  0x0000000106fcf488 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1123748   19  AppName                  0x0000000106fd11d0 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1131244   20  AppName                  0x00000001070e7b9c 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 2272440   21  AppName                  0x00000001070ef1e8 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 2302724   22  Foundation                          0x000000018cfa47ac 6E76DC96-11AF-3B2E-B71E-
215F9CC6E822 + 243628   23  CoreFoundation                      0x0000000192d7e128 4230C122-42E8-
383B-BEEC-EE7B61F8BB61 + 864552 24  CoreFoundation                      0x0000000192d8a7b4 4230C122-
42E8-383B-BEEC-EE7B61F8BB61 + 915380    25  CoreFoundation                      0x0000000192d0f5e8 
4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 411112   26  CoreFoundation                      
0x0000000192d250d4 4230C122-42E8-383B-BEEC-EE7B61F8BB61 + 499924    27  CoreFoundation                      

0x0000000192d2a3ec CFRunLoopRunSpecific + 612   28  GraphicsServices                    0x00000001ce1ef35c GSEventRunModal + 164    29  UIKitCore                           
0x00000001950b76e8 B3834960-244B-34E4-9EA0-CA4BB44EF0F3 + 3790568   30  UIKitCore                           
0x00000001950b734c UIApplicationMain + 340  31  AppName                  0x0000000106e05bb0 
xamarin_UIApplicationMain + 24  32  AppName                  0x000000010514e5a0 
_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 34506444 
33  AppName                  0x0000000106c94738 
_ZN9GMSx_absl13base_internal10AtomicHookIPFvPKciS3_S3_S3_EE13DummyFunctionES3_iS3_S3_S3_ + 63105124 

34  AppName                  0x0000000107078fa0 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1818812   35  AppName                  0x0000000106fcdbd8 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1117428   36  AppName                  0x0000000106fd4264 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1143680   37  AppName                  0x000000010707df40 
_ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 1839196   38  AppName                  0x0000000106e10e10 xamarin_log + 4720  39  AppName                  
0x00000001070e2d2c _ZNK3icu6number23NumberFormatterSettingsINS0_24LocalizedNumberFormatterEE10toSkeletonER10UErrorCode 
+ 2252360   40  dyld                                0x00000001b222adec 8A423F3F-B318-315E-99C7-
05EE532E9C0D + 89580

为什么我只在发布模式下有这个问题,而在调试模式下没有?我该怎么解决呢?

7fyelxc5

7fyelxc51#

你的错误不能是你的错。我猜这个问题与iOS中的列表视图有关,特别是当您尝试使用

GroupDisplayBinding="{Binding Key}" GroupShortNameBinding="{Binding Key}"

尝试改变方式,使用collectionView,如下面的link
对我很有效。

相关问题