我目前正在使用PCL在iOS平台上创建xamarin表单应用程序。在应用程序输出中,每当切换页面时,都会显示以下消息:
Unbalanced calls to begin/end appearance transitions for <Xamarin_Forms_Platform_iOS_NavigationRenderer_ParentingViewController: 0x10526a7c0>.
继续切换页面几分钟后,我终于收到以下消息:
2018-08-14 13:46:02.633 MC_Phone.iOS[1943:245399] Unbalanced calls to begin/end appearance transitions for <Xamarin_Forms_Platform_iOS_NavigationRenderer_ParentingViewController: 0x10526a7c0>.
2018-08-14 13:46:04.599 MC_Phone.iOS[1943:245399] critical: Stacktrace:
2018-08-14 13:46:04.599 MC_Phone.iOS[1943:245399] critical: at <unknown> <0xffffffff>
2018-08-14 13:46:04.599 MC_Phone.iOS[1943:245399] critical: at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <0x00007>
2018-08-14 13:46:04.602 MC_Phone.iOS[1943:245399] critical: at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIApplication.cs:79
2018-08-14 13:46:04.602 MC_Phone.iOS[1943:245399] critical: at UIKit.UIApplication.Main (string[],string,string) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.12.0.4/src/Xamarin.iOS/UIKit/UIApplication.cs:63
2018-08-14 13:46:04.603 MC_Phone.iOS[1943:245399] critical: at MC_Phone.iOS.Application.Main (string[]) [0x00007] in /Users/petercardenas/Documents/Berk/MC_Phone4_1 Updated/MC_Phone/MC_Phone.iOS/Main.cs:13
2018-08-14 13:46:04.603 MC_Phone.iOS[1943:245399] critical: at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) [0x0001e] in <b238a3153e534349ad10ed0787f2157a#AFB9630D-719E-DB9C-AF13-58F1BC53B75F>:0
2018-08-14 13:46:04.604 MC_Phone.iOS[1943:245399] critical:
Native stacktrace:
2018-08-14 13:46:04.660 MC_Phone.iOS[1943:245399] critical: 0 libmonosgen-2.0.dylib 0x0000000104ca9b24 mono_handle_native_crash + 224
2018-08-14 13:46:04.660 MC_Phone.iOS[1943:245399] critical: 1 libmonosgen-2.0.dylib 0x0000000104cb6680 mono_sigsegv_signal_handler + 316
2018-08-14 13:46:04.661 MC_Phone.iOS[1943:245399] critical: 2 libsystem_platform.dylib 0x0000000182e4cb58 _sigtramp + 52
2018-08-14 13:46:04.661 MC_Phone.iOS[1943:245399] critical: 3 UIKit 0x000000018d183318 <redacted> + 1024
2018-08-14 13:46:04.661 MC_Phone.iOS[1943:245399] critical: 4 UIKit 0x000000018cef2a4c <redacted> + 708
2018-08-14 13:46:04.661 MC_Phone.iOS[1943:245399] critical: 5 UIKit 0x000000018cef26a4 <redacted> + 164
2018-08-14 13:46:04.661 MC_Phone.iOS[1943:245399] critical: 6 UIKit 0x000000018cee63a8 <redacted> + 188
2018-08-14 13:46:04.661 MC_Phone.iOS[1943:245399] critical: 7 UIKit 0x000000018ce3e6f4 <redacted> + 1420
2018-08-14 13:46:04.662 MC_Phone.iOS[1943:245399] critical: 8 QuartzCore 0x00000001873b3e54 <redacted> + 184
2018-08-14 13:46:04.662 MC_Phone.iOS[1943:245399] critical: 9 QuartzCore 0x00000001873b7fe4 <redacted> + 324
2018-08-14 13:46:04.662 MC_Phone.iOS[1943:245399] critical: 10 QuartzCore 0x00000001873246c8 <redacted> + 320
2018-08-14 13:46:04.662 MC_Phone.iOS[1943:245399] critical: 11 QuartzCore 0x000000018734c1b0 <redacted> + 580
2018-08-14 13:46:04.662 MC_Phone.iOS[1943:245399] critical: 12 QuartzCore 0x000000018734d030 <redacted> + 92
2018-08-14 13:46:04.662 MC_Phone.iOS[1943:245399] critical: 13 CoreFoundation 0x00000001831d2910 <redacted> + 32
2018-08-14 13:46:04.663 MC_Phone.iOS[1943:245399] critical: 14 CoreFoundation 0x00000001831d0238 <redacted> + 412
2018-08-14 13:46:04.663 MC_Phone.iOS[1943:245399] critical: 15 CoreFoundation 0x00000001831d0884 <redacted> + 1436
2018-08-14 13:46:04.663 MC_Phone.iOS[1943:245399] critical: 16 CoreFoundation 0x00000001830f0da8 CFRunLoopRunSpecific + 552
2018-08-14 13:46:04.663 MC_Phone.iOS[1943:245399] critical: 17 GraphicsServices 0x00000001850d6020 GSEventRunModal + 100
2018-08-14 13:46:04.663 MC_Phone.iOS[1943:245399] critical: 18 UIKit 0x000000018d110758 UIApplicationMain + 236
2018-08-14 13:46:04.664 MC_Phone.iOS[1943:245399] critical: 19 libXamarin.iOS.dll.dylib 0x00000001034cb8f0 wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 368
2018-08-14 13:46:04.664 MC_Phone.iOS[1943:245399] critical: 20 libXamarin.iOS.dll.dylib 0x000000010345765c UIKit_UIApplication_Main_string___intptr_intptr + 44
2018-08-14 13:46:04.664 MC_Phone.iOS[1943:245399] critical: 21 libXamarin.iOS.dll.dylib 0x000000010345761c UIKit_UIApplication_Main_string___string_string + 172
2018-08-14 13:46:04.665 MC_Phone.iOS[1943:245399] critical: 22 libMC_Phone.iOS.exe.dylib 0x0000000100f820b4 MC_Phone_iOS_Application_Main_string__ + 164
2018-08-14 13:46:04.665 MC_Phone.iOS[1943:245399] critical: 23 libmscorlib.dll.dylib 0x0000000101312f28 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 248
2018-08-14 13:46:04.665 MC_Phone.iOS[1943:245399] critical: 24 libmonosgen-2.0.dylib 0x0000000104cb9778 mono_jit_runtime_invoke + 904
2018-08-14 13:46:04.665 MC_Phone.iOS[1943:245399] critical: 25 libmonosgen-2.0.dylib 0x0000000104d388a4 mono_runtime_invoke_checked + 148
2018-08-14 13:46:04.666 MC_Phone.iOS[1943:245399] critical: 26 libmonosgen-2.0.dylib 0x0000000104d3e61c mono_runtime_exec_main_checked + 120
2018-08-14 13:46:04.666 MC_Phone.iOS[1943:245399] critical: 27 libmonosgen-2.0.dylib 0x0000000104c9b608 mono_jit_exec + 268
2018-08-14 13:46:04.666 MC_Phone.iOS[1943:245399] critical: 28 libxamarin-debug.dylib 0x0000000104fe0cd8 xamarin_main + 2220
2018-08-14 13:46:04.666 MC_Phone.iOS[1943:245399] critical: 29 MC_Phone.iOS 0x0000000100f33784 MC_Phone.iOS + 210820
2018-08-14 13:46:04.667 MC_Phone.iOS[1943:245399] critical: 30 libdyld.dylib 0x0000000182b81fc0 <redacted> + 4
2018-08-14 13:46:04.667 MC_Phone.iOS[1943:245399] critical:
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
这是主页布局
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MC_Phone.Views;assembly=MC_Phone"
x:Class="MC_Phone.TabbedPage1">
<NavigationPage Title="Investor" Icon="investor.png">
<x:Arguments>
<local:InvestorPage />
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Portfolio" Icon="portfolio.png">
<x:Arguments>
<local:TotalAllocationPage />
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Results" Icon="results.png">
<x:Arguments>
<local:ResultPage />
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Growth" Icon="growth.png">
<x:Arguments>
<local:MCSimulationPage />
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Asset Allocation" Icon="assetAlloc.png">
<x:Arguments>
<local:AssetAllocationPage />
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Description" Icon="description.png">
<x:Arguments>
<local:DescriptionPage />
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Disclaimer" Icon="disclaimer.png">
<x:Arguments>
<local:DisclaimerPage/>
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Data Sources" Icon="dataSources.png">
<x:Arguments>
<local:DataSourcesPages/>
</x:Arguments>
</NavigationPage>
<NavigationPage Title="About" Icon="about.png">
<x:Arguments>
<local:AboutPage/>
</x:Arguments>
</NavigationPage>
</TabbedPage>
这是实现所有页面的主页扩展。
namespace MC_Phone
{
public class MainPage : TabbedPage
{
public MainPage()
{
Page investorPage, totalAllocationPage, resultPage, mcSimulationPage, assetAllocationPage, descriptionPage = null;
switch (Device.RuntimePlatform)
{
case Device.iOS:
investorPage = new NavigationPage(new InvestorPage())
{
Title = "Investor"
};
totalAllocationPage = new NavigationPage(new TotalAllocationPage())
{
Title = "Total Allocation"
};
resultPage = new NavigationPage(new ResultPage())
{
Title = "Result"
};
mcSimulationPage = new NavigationPage(new MCSimulationPage())
{
Title = "MCSimulation"
};
assetAllocationPage = new NavigationPage(new AssetAllocationPage())
{
Title = "Asset Allocation"
};
descriptionPage = new NavigationPage(new DescriptionPage())
{
Title = "Description"
};
break;
default:
investorPage = new InvestorPage()
{
Title = "Investor"
};
totalAllocationPage = new TotalAllocationPage()
{
Title = "Total Allocation"
};
resultPage = new ResultPage()
{
Title = "Result"
};
mcSimulationPage = new MCSimulationPage()
{
Title = "MCSimulation"
};
assetAllocationPage = new AssetAllocationPage()
{
Title = "Asset Allocation"
};
descriptionPage = new DescriptionPage()
{
Title = "Description"
};
break;
}
Children.Add(investorPage);
Children.Add(totalAllocationPage);
Children.Add(resultPage);
Children.Add(mcSimulationPage);
Children.Add(assetAllocationPage);
Children.Add(descriptionPage);
List<ToolbarItem> toolbarItems = new List<ToolbarItem>()
{
new ToolbarItem{ Text = "Run"},
new ToolbarItem{ Text = "Clear"}
};
if (Device.RuntimePlatform != Device.iOS)
{
Title = Children[0].Title;
}
}
}
}
这是app.xaml.cs
namespace MC_Phone
{
public partial class App : Application
{
public static bool IsIOS;
public static TabbedPage TabbedPage;
public App()
{
InitializeComponent();
TabbedPage = new TabbedPage1();
MainPage = TabbedPage;
}
}
}
我将如何更改我的代码,以使应用程序在导航页面之间移动时不会冻结?