WP8.1 application crashes on calling RequestProductPurchaseAsync

[亡魂溺海] 提交于 2019-12-31 01:11:49

问题


I'm writing Audio Player for Windows Phone 8.1 (Runtime) and I use IBackgroundTask for audio.

I want to use in-app purchase, but applications crashes on calling

var result = await CurrentAppSimulator.RequestProductPurchaseAsync(ProProductId);

without any exceptions.

This method is called within try-catch block.

It happens when application already start IBackgroundTask by calling for BackgroundMediaPlayer.Current (happens after few seconds after call RequestProductPurchaseAsync).

If I call RequestProductPurchaseAsync after start app without calling BackgroundMediaPlayer.Current, it works normally.

What the reason of this behaviour? There are some ways to solve this problem?


回答1:


I am having the same problem, app just crashes, no exception thrown. Happens with CurrentAppSimulator as well as CurrentApp.

The only solution I came up with was to kill the Backround task

BackgroundMediaPlayer.Shutdown()

before making the IAP. Make sure you also put in a bit of delay after calling shutdown, sometimes the app still crashed without it (but not as often, so I guess there was some delay during the shutdown process)



来源:https://stackoverflow.com/questions/28020233/wp8-1-application-crashes-on-calling-requestproductpurchaseasync

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