I am developing a Windows phone 8 application. Everything is working fine, but while i am navigating from one screen to other (using NavigationService.Navigate) , the app closes intermittently. There are no errors/exceptions but app closes and takes me to the apps list. This is happening 1-2 times if i navigation around 10 times.
我正在开发一个Windows Phone 8应用程序。一切正常,但是当我从一个屏幕导航到另一个屏幕时(使用NavigationService.Navigate),应用程序会间歇性地关闭。没有错误/异常,但app关闭并将我带到应用列表。如果我导航10次,这将发生1-2次。
Anyone else also facing same issue?, please share the solution for the same.
其他人也面临同样的问题吗?请分享相同的解决方案。
2 个解决方案
#1
So it's easy, use relative, because it's relative to the current directory.
因此它很容易,使用相对,因为它相对于当前目录。
Change
NavigationService.Navigate(new Uri("/Home.xaml", UriKind.RelativeOrAbsolute));
to
NavigationService.Navigate(new Uri("/Home.xaml", UriKind.Relative));
NavigationService.Navigate(new Uri(“/ Home.xaml”,UriKind.Relative));
#2
If you're navigating between the same pages, you should use the first opened page as the start point and then use backward navigation to return to that page:
如果您在相同页面之间导航,则应使用第一个打开的页面作为起点,然后使用向后导航返回到该页面:
NavigationService.GoBack();
This removes the current page from the BackStack
and restores the previous one. Otherwise use the normal navigation:
这将从BackStack中删除当前页面并恢复前一页面。否则使用正常导航:
NavigationService.Navigate(new Uri("/MyNewPage.xaml", UriKind.Relative));
NavigationService.Navigate(new Uri(“/ MyNewPage.xaml”,UriKind.Relative));
You should try that and if it doesn't help, debug the page initialization and loads line by line.
您应该尝试,如果它没有帮助,调试页面初始化并逐行加载。
#1
So it's easy, use relative, because it's relative to the current directory.
因此它很容易,使用相对,因为它相对于当前目录。
Change
NavigationService.Navigate(new Uri("/Home.xaml", UriKind.RelativeOrAbsolute));
to
NavigationService.Navigate(new Uri("/Home.xaml", UriKind.Relative));
NavigationService.Navigate(new Uri(“/ Home.xaml”,UriKind.Relative));
#2
If you're navigating between the same pages, you should use the first opened page as the start point and then use backward navigation to return to that page:
如果您在相同页面之间导航,则应使用第一个打开的页面作为起点,然后使用向后导航返回到该页面:
NavigationService.GoBack();
This removes the current page from the BackStack
and restores the previous one. Otherwise use the normal navigation:
这将从BackStack中删除当前页面并恢复前一页面。否则使用正常导航:
NavigationService.Navigate(new Uri("/MyNewPage.xaml", UriKind.Relative));
NavigationService.Navigate(new Uri(“/ MyNewPage.xaml”,UriKind.Relative));
You should try that and if it doesn't help, debug the page initialization and loads line by line.
您应该尝试,如果它没有帮助,调试页面初始化并逐行加载。