PhoneGap app crashes on WP8.1

风流意气都作罢 提交于 2020-01-01 12:11:11

问题


tl;dr - I can't seem to get a PhoneGap app to run successfully on WP8.1. There are a number of problems in my process of diagnosing the issue.

Setting: I created a PhoneGap 3.4 Windows Phone app, tested it on Windows Phone 8 using Visual Studio 2012 for WP, and submitted it. I got loads of crash reports from people with Windows Phone 8.1.

Diagnosing the problem: I went ahead and tried to run the app on a WP8.1 emulator using Visual Studio 2013 for Windows. I get the following error:

Deployment of application to device failed.
Exception from HRESULT: 0x89721500

I then try selecting "Retarget to Windows Phone 8.1". The app launches and the splash screen shows, but it then crashes as well and I get the following error:

An exception of type 'System.SystemException' occurred in Microsoft.Phone.Interop.ni.dll but was not handled in user code

Additional information: An unknown error has occurred. Error: 80020006.

If there is a handler for this exception, the program may be safely continued.

Tried to sideload an existing XAP: Thinking there may just be something off in running this app via VS2013, I thought I might try sideloading it. Problem is, there isn't a XapDeploy.exe for the 8.1 emulator and I can't seem to download/open apps from the internet in the emulator.

Trying to figure out what's what: None of this is terribly useful, especially given how new WP8.1 is and how relatively few people deal with PhoneGap; there aren't many people who have encountered this kind of an issue so there isn't much online. I've tried everything above with a fresh app created by PhoneGap, no difference.

Any help here, pointing me in any direction, would be incredibly helpful.

A workaround: A workaround, if I can't get this to work, is to just exclude support for 8.1; keep people with 8.1 from downloading the app/app version. Is there any way for me to do that? I can't seem to find a way for that anywhere.


回答1:


I had the same problem with my project. If your project is asynchronously loading more than one external file (.html, .js, ...) I found a solution.

I debugged what was the root of this problem, and getting simpler cordova seed examples it seem to run, and going slowly to my project state, I saw that it crashes in the cordova file XHRHelper.cs when I load more than one file at once.

Finally, I found in https://issues.apache.org/jira/browse/CB-4873 the solution. There seems to be some kind of bug with cordova and Windows Phone 8.1, that when he tries to asynchronously load more than one file, it crashes.

There's a comment there from Maris Seimanovs that fixed it by providing a modified XHRHelper file that has solved the issue for me: https://gist.github.com/anonymous/5bf4d9ba9cdb5d0f3f3e

Remember that you can find the XHRHelper file in platforms/wp8/cordovalib/XHRHelper.cs

I hope it also helps you.




回答2:


I had this problem, and followed all other solutions I could find but it didn't work, the Exception thrown: 'System.SystemException' in Microsoft.Phone.Interop.ni.dll message remained.

It took me hours to discover that I had a poorly formatted Content-Security-Policy meta tag - I had missed off the closing quote from the content attribute.

Putting in the closing quote fixed the error. It's hard to believe a simple markup syntax error could bring it all crashing down so badly.

I thought I'd share this on this SO thread as this seems to be the highest Google hit for the error, and no doubt others will have the same problem as me.



来源:https://stackoverflow.com/questions/23819485/phonegap-app-crashes-on-wp8-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!