开发者

Windows Phone - Application crashes when disconnected from PC

Whenever开发者_如何学C I disconnect my Windows Phone from PC (connected through USB) and if my application is running, my application hangs for sometime and then application crashes.

Does anyone experienced same behavior? I guess switching for PC connection to Wi-Fi/GPRS is causing the issue.


the windows Phone Requires that you Safely Remove hardware first, after a few times when i started Development on the windows phone i did the same and Ended up getting a new Phone. So plainly put, try to Safely Remove and Make sure it is installing the app to the Device.

Meaning if you Remove the phone, the App is still able to be ran just like a normal downloaded App form the Market place.

if you want more in depth information, i would suggest Reading the WP7 Everything Programming ebook lol

its filled with good information, and Definitely Helped me along my road to Love DEV for WP7.


As gamernb says, if you disconnect the USB from a properly tethered Windows Phone (i.e. connected to Zune, or using the WPConnect utility), the phone's network connection will be reset and your app's connections will be terminated. The phone will then start trying to connect using WiFi or cellular data (if they are on), but this can take quite a while.

You will have to handle this network disconnection in your app - I've found that pulling the USB cable in this way is a good ad-hoc test for WP7 apps: do an action which you know will use the network connection. Then watch if the app crashes, or handles this gracefully.

Actually you aren't guaranteed to always use the PC data connection: if you make sure that the computer has no data connection (i.e. pull the Ethernet cable, turn off WiFi etc ), the WP7 app can then use cellular data or WiFi on the phone instead.


Alas-

you could set perimeters in your application to Check what the connection type is, then Make changes accordingly.

You May have a slight freeze, but that's better then a crash....mainly when the phone switches from PC to WWAN, their would be a slight Pause.

use the Reachability Class and NSLog to Figure out whats going on exactly.

I really hope that helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜