[UWP]请求率应用对话框 [英] [UWP]Requesting Rate App Dialog
问题描述
我已经有了启动费率应用对话框弹出窗口的代码,它工作正常。
I've had code to launch the rate app dialog popup and it was working fine.
我刚刚注意到当我尝试从商店评价我的应用时我的应用程序崩溃了。在调试时我注意到服务器正在返回json
I've just noticed when I try to rate my app from the store my app is crashing. While debuging I noticed that the server is returning the json
{{ "purchaseStatus":"ServerError", "错误":-2147467261}}
{{ "purchaseStatus": "ServerError", "error": -2147467261}}
因为我使用的是此处的代码
Since I was using the code from here
https://docs.microsoft.com/en-us/windows/uwp/monetize/request-ratings-and-reviews
https://docs.microsoft.com/en-us/windows/uwp/monetize/request-ratings-and-reviews
< span style ="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; font- size:14px; white-space:pre"> public
async 任务< < span style ="color:#0101fd"> bool >
ShowRatingReviewDialog () {
StoreSendRequestResult result = await
StoreRequestHelper.SendRequestAsync(StoreContext.GetDefault(), 16 ,
String.Empty); if <> span
(result.ExtendedError == null )
{JObject jsonObject = JObject.Parse(result.Response); 如果
(jsonObject.SelectToken( " status" )。ToString()
== "成功" )
{ //客户评价或审核了
app。
return
true ;
}} //请求有错误,
或客户选择不
//评价或评论应用程序。
return
false ;
}
public async Task<bool> ShowRatingReviewDialog() { StoreSendRequestResult result = await StoreRequestHelper.SendRequestAsync( StoreContext.GetDefault(), 16, String.Empty); if (result.ExtendedError == null) { JObject jsonObject = JObject.Parse(result.Response); if (jsonObject.SelectToken("status").ToString() == "success") { // The customer rated or reviewed the app. return true; } } // There was an error with the request, or the customer chose not to // rate or review the app. return false; }
该行
if <> span
(jsonObject.SelectToken( " status" )。ToString()
== "success" ; )
导致异常。
是否有其他人看到此行为?我想知道我的机器是否有点奇怪,因为我有一些ms帐户问题。
Is anyone else seeing this behaviour? I'm wonder if it something odd with my machine since I have been having a bit of ms account issues.
推荐答案
您好,
我可以知道您的操作系统版本吗?什么是你的应用程序的目标版本?
May I know your OS version? And what's the target version of your app?
什么是异常消息?
What's the exception message?
你从这里得到什么JsonObject: JObject jsonObject = JObject.Parse(result.Response)
?
What's the JsonObject that you get from here:JObject jsonObject = JObject.Parse(result.Response) ?
它是否具有"status"状态你正在寻找的部分?我怀疑这会导致问题。
Does it has the "status" part that you are looking for? I suspect this causes the problem.
祝你好运,
Roy
这篇关于[UWP]请求率应用对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!