1

I have written file picker code in my project. When i run the project in my windows phone by clicking on device button in visual studio, the app runs fine(I mean it opens pictures library and i can select a photo and preview it).

But when I disconnect my usb and then open the app in the phone and when i open pictures library on click of a button , the pictures library opens briefly and then the app crashes immediately(My app closes). Can anyone please help me with this??

4

2 回答 2

1

正如博客文章中所写,AndContinue 方法在不同的进程中运行,为此,当前正在运行的应用程序会进入后台,有时甚至会关闭,据我所知,这就是您在应用程序中遇到的情况,但不是确定为什么在调试和部署期间会发生不同的事情。app.xaml.cs 中必须有一个回调,专门用于处理调用应用程序(已发送到后台)进入前台时的条件,请仔细阅读此博客文章,您将了解代码中需要更改的内容: using-the-andcontinue-methods-in-windows-phone http://blogs.msdn.com/b/wsdevsol/archive/2014/05/08/using-the-andcontinue-methods-in-windows-phone-silverlight -8-1-apps.aspx

于 2014-11-13T18:09:42.860 回答
1

我刚刚处理了这个问题,调试和部署之间存在差异的原因之一是暂停事件。在调试期间,应用程序实际上并没有被挂起,直到您通过生命周期事件手动执行它。这意味着当您在调试时选择文件并将应用程序置于后台以加载文件选择器时,它实际上并没有被暂停,而当应用程序被部署时,它实际上被暂停了。

查看 app.xaml 中的 app_resuming 方法和 OnSuspending 方法,这些方法可能会导致在调试期间未发生错误。

于 2015-03-25T22:39:43.903 回答