在调用RequestProductPurchaseAsync WP8.1应用程序崩溃 [英] WP8.1 application crashes on calling RequestProductPurchaseAsync
问题描述
我写的音频播放器的对的的Windows Phone 8.1(运行)的我用 IBackgroundTask
为音频
。
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.
这方法try-catch块中调用。
This method is called within try-catch block.
它发生时,应用程序已经启动 IBackgroundTask
BackgroundMediaPlayer.Current 电话后几秒钟后(发生> RequestProductPurchaseAsync
)。
It happens when application already start IBackgroundTask
by calling for BackgroundMediaPlayer.Current
(happens after few seconds after call RequestProductPurchaseAsync
).
如果我称之为 RequestProductPurchaseAsync
后无需调用启动应用程序 BackgroundMediaPlayer.Current
,它正常工作。
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?
推荐答案
我有同样的问题,只是应用程序崩溃,没有任何的异常。与 CurrentAppSimulator
发生以及 CurrentApp
。
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()
使得IAP之前。请确保您还放了一点延迟调用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)
这篇关于在调用RequestProductPurchaseAsync WP8.1应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!