C# 尝试测试应用内产品购买时出现TargetInvestment异常
我正在尝试在C中测试Windows Phone 8应用程序的应用程序内产品购买# 我一直在关注如何实施这样的事情 在以下链接中: 我试图做的动作是:点击C# 尝试测试应用内产品购买时出现TargetInvestment异常,c#,windows-phone-8,in-app-purchase,C#,Windows Phone 8,In App Purchase,我正在尝试在C中测试Windows Phone 8应用程序的应用程序内产品购买# 我一直在关注如何实施这样的事情 在以下链接中: 我试图做的动作是:点击按钮 代码如下: async private void btnBuy50Points_Click_1(object sender, RoutedEventArgs e) { // 50 Points - Consumable var listing = await CurrentApp.LoadListin
按钮
代码如下:
async private void btnBuy50Points_Click_1(object sender, RoutedEventArgs e)
{
// 50 Points - Consumable
var listing = await CurrentApp.LoadListingInformationAsync();
var fiftypoints =
listing.ProductListings.FirstOrDefault(
p => p.Value.ProductId == "coinX" && p.Value.ProductType == ProductType.Consumable);
try
{
receipt = await CurrentApp.RequestProductPurchaseAsync(fiftypoints.Value.ProductId, true);
if (CurrentApp.LicenseInformation.ProductLicenses[fiftypoints.Value.ProductId].IsActive)
{
CurrentApp.ReportProductFulfillment(fiftypoints.Value.ProductId);
Coins += 50;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
调试时:应用程序崩溃,出现TargetInvocationException
第行:var listing=wait CurrentApp.LoadListingInformationAsync()代码>我的代码中没有编码错误,我只是在3小时后完成了相同的过程,它工作了,问题是我必须在提交应用内产品时等待2小时,然后才能测试它。内部异常是什么?你能试着在任务内调用。Run()
lambda吗?我模糊地记得它在UI线程上不起作用。@PeterTorr MSFT它现在起作用了,事实证明,你必须等到microsoft在提交产品时批准该应用程序,然后你才能测试它,我现在该怎么办?回答我自己的问题?是的,你可以回答你自己的问题。