Xamarin表示应用程序在iOS上启动时崩溃

时间:2017-03-21 21:47:24

标签: xamarin.ios xamarin.forms

我是Xamarin的新手,不知道我做错了什么。我打包了一个企业应用程序,目前正在尝试将其部署为ipa包。应用程序在启动时崩溃并出现以下跟踪。真的不知道如何继续,崩溃的核心原因是什么

修改的。禁用程序集链接后更新了堆栈跟踪:

Thread 0 name:  tid_403  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x000000018f2f7014 __pthread_kill + 8
1   libsystem_pthread.dylib         0x000000018f3bf450 pthread_kill + 112
2   libsystem_c.dylib               0x000000018f26b400 abort + 140
3   CrewConnectPlus.iOS             0x0000000100065604 mono_handle_native_sigsegv (mini-exceptions.c:2462)
4   libsystem_platform.dylib        0x000000018f3b9348 _sigtramp + 52
5   libsystem_pthread.dylib         0x000000018f3bf450 pthread_kill + 112
6   libsystem_c.dylib               0x000000018f26b400 abort + 140
7   CrewConnectPlus.iOS             0x00000001001682b0 print_all_exceptions(MonoObject*) (runtime.m:991)
8   CrewConnectPlus.iOS             0x00000001000a2398 mono_invoke_unhandled_exception_hook (exception.c:1108)
9   CrewConnectPlus.iOS             0x0000000100065298 mono_handle_exception_internal (mini-exceptions.c:1810)
10  CrewConnectPlus.iOS             0x0000000100064374 mono_handle_exception (mini-exceptions.c:2039)
11  CrewConnectPlus.iOS             0x000000010005cbbc mono_arm_throw_exception (exceptions-arm64.c:410)
12  CrewConnectPlus.iOS             0x000000010067c248 throw_exception + 168
13  CrewConnectPlus.iOS             0x0000000100405e08 System_AppDomain_Load_System_Reflection_AssemblyName_System_Security_Policy_Evidence + 1000
14  CrewConnectPlus.iOS             0x0000000100405960 System_AppDomain_Load_System_Reflection_AssemblyName + 32
15  CrewConnectPlus.iOS             0x0000000100457884 System_Reflection_Assembly_Load_System_Reflection_AssemblyName + 36
16  CrewConnectPlus.iOS             0x00000001024712f8 Xamarin_Forms_Xaml_XamlParser_GetElementType_Xamarin_Forms_Xaml_XmlType_System_Xml_IXmlLineInfo_System_Reflection_Assembly_Xamarin_Forms_Xaml_XamlParseException_ (/C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Xaml\XamlParser.cs:287)
17  CrewConnectPlus.iOS             0x00000001024687a0 Xamarin_Forms_Xaml_CreateValuesVisitor_Visit_Xamarin_Forms_Xaml_ElementNode_Xamarin_Forms_Xaml_INode (/C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Xaml\CreateValuesVisitor.cs:69)
18  CrewConnectPlus.iOS             0x0000000102463bac Xamarin_Forms_Xaml_ElementNode_Accept_Xamarin_Forms_Xaml_IXamlNodeVisitor_Xamarin_Forms_Xaml_INode (/C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Xaml\XamlNode.cs:178)
19  CrewConnectPlus.iOS             0x0000000102463b10 Xamarin_Forms_Xaml_ElementNode_Accept_Xamarin_Forms_Xaml_IXamlNodeVisitor_Xamarin_Forms_Xaml_INode (/C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Xaml\XamlNode.cs:173)
20  CrewConnectPlus.iOS             0x00000001024642a8 Xamarin_Forms_Xaml_RootNode_Accept_Xamarin_Forms_Xaml_IXamlNodeVisitor_Xamarin_Forms_Xaml_INode (/C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Xaml\XamlNode.cs:224)
21  CrewConnectPlus.iOS             0x0000000102462820 Xamarin_Forms_Xaml_XamlLoader_Visit_Xamarin_Forms_Xaml_RootNode_Xamarin_Forms_Xaml_HydratationContext (/C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Xaml\XamlLoader.cs:122)
22  CrewConnectPlus.iOS             0x0000000102462298 Xamarin_Forms_Xaml_XamlLoader_Load_object_string (/C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Xaml\XamlLoader.cs:80)
23  CrewConnectPlus.iOS             0x0000000102461fec Xamarin_Forms_Xaml_XamlLoader_Load_object_System_Type (/C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Xaml\XamlLoader.cs:57)
24  CrewConnectPlus.iOS             0x0000000102461f60 Xamarin_Forms_Xaml_Extensions_LoadFromXaml_TXaml_REF_TXaml_REF_System_Type (/C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Xaml\ViewExtensions.cs:37)
25  CrewConnectPlus.iOS             0x000000010016f4e0 CrewConnectPlus_Messages_InitializeComponent (/<unknown>:1)
26  CrewConnectPlus.iOS             0x000000010016f1e0 CrewConnectPlus_Messages__ctor (/<unknown>:1)
27  CrewConnectPlus.iOS             0x000000010016ee14 CrewConnectPlus_App_GoToMainPage (/<unknown>:1)
28  CrewConnectPlus.iOS             0x000000010016ed9c CrewConnectPlus_App_SetMainPage (/<unknown>:1)
29  CrewConnectPlus.iOS             0x000000010016ed58 CrewConnectPlus_App__ctor (/<unknown>:1)
30  CrewConnectPlus.iOS             0x000000010016cc10 CrewConnectPlus_iOS_AppDelegate_FinishedLaunching_UIKit_UIApplication_Foundation_NSDictionary (/<unknown>:1)

确定终于设法在物理设备上找到了一个并且为了调试问题而经历了创建开发配置文件的Apple麻烦:

似乎我的主要xaml文档(Messages.xaml)无法加载从属文档(APMHeader.xaml)。

Messages.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" 
    xmlns:apm="clr-namespace:CrewConnectPlus;assembly=CrewConnectPlus"
    x:Class="CrewConnectPlus.Messages" Title="{Binding Title}" x:Name="BrowseItemsPage">
    <ContentPage.ToolbarItems>
        <ToolbarItem Text="Sign All" Clicked="AddItem_Clicked" />
    </ContentPage.ToolbarItems>
    <ContentPage.Content>
        <StackLayout>
            <apm:APMHeader/> 
            <ListView x:Name="ItemsListView" ItemsSource="{Binding Items}" VerticalOptions="FillAndExpand" HasUnevenRows="true" RefreshCommand="{Binding LoadItemsCommand}" IsPullToRefreshEnabled="true" IsRefreshing="{Binding IsBusy, Mode=OneWay}" CachingStrategy="RecycleElement" ItemSelected="OnItemSelected">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout Padding="10">
                                <Label Text="{Binding Text}" LineBreakMode="NoWrap" Style="{DynamicResource ListItemTextStyle}" FontSize="16" />
                                <Label Text="{Binding Description}" LineBreakMode="NoWrap" Style="{DynamicResource ListItemDetailTextStyle}" FontSize="13" />
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

APMHeader由:

给出
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
    x:Class="CrewConnectPlus.APMHeader">
    <ContentView.Content>
        <StackLayout BackgroundColor="#25447A" HorizontalOptions="Fill" HeightRequest="100">
            <Label Margin="10">
                <Label.TextColor>Yellow</Label.TextColor>
                <Label.Text>Anwar Ludin</Label.Text>
            </Label>
            <Label Margin="10">
                <Label.TextColor>White</Label.TextColor>
                <Label.Text>ALU</Label.Text>
            </Label>
        </StackLayout>
    </ContentView.Content>
</ContentView>

错误是:

Xamarin.Forms.Xaml.XamlParseException: Position 11:5. Type apm:APMHeader not found in xmlns clr-namespace:CrewConnectPlus;assembly=CrewConnectPlus
  at Xamarin.Forms.Xaml.CreateValuesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, Xamarin.Forms.Xaml.INode parentNode)

这在Android设备和iPhone模拟器上运行良好。不确定物理设备上有什么不同。我还检查了输出程序集名称是CrewConnectPlus

1 个答案:

答案 0 :(得分:0)

我(很晚)参加这个聚会,但是设置属性的方式看起来很奇怪。

尝试更改:

 <Label Margin="10">
                <Label.TextColor>Yellow</Label.TextColor>
                <Label.Text>Anwar Ludin</Label.Text>
            </Label>

 <Label Margin="10" TextColor="Yellow" Text="Anwar Ludin">
            </Label>

加上它的简洁性,就这样。