2015-12-21 64 views
14

我试图在我的应用程序(已在Windows 10商店中)上启用应用程序内购买项目,但试图购买此项目时我总是收到相同的错误消息:Windows 10中的应用程序内购买问题UWP

This in-App Purchase item is no longer available in MyAppName

此应用程序内购买产品不再提供MyAppName

的代码是相当简单的,只是什么样的文档建议:

var itemName = "app.advanced_items.full"; 
if (CurrentApp.LicenseInformation.ProductLicenses[itemName].IsActive) { 
    return true; 
} 
var results = await CurrentApp.RequestProductPurchaseAsync(itemName); 

if (results.Status == ProductPurchaseStatus.Succeeded || 
    results.Status == ProductPurchaseStatus.AlreadyPurchased) { 
    return true; 
} else { 
    return false; 
} 

的更多信息:

  • 我创建并submited在应用程序的项目店里构建软件包之前的文档告诉我
  • 该项目的名称是相同的两个在商店和应用程序(itemName上的代码)
  • 我试过这之前提交到商店
  • 我试过后提交到商店(我的应用程序目前打破了那里! - 无法购买物品)

我怀疑问题可能与以下有关:

  • 该应用程序的显示名称(上Package.appxmanifest)是不是在商店相同的应用程序名称(我想要的名称是不可用的,所以我做了更长的时间,但安装后的应用程序将显示原始名称)。这个较短的名称是错误信息中的一个...

我将“显示名称”更改为应用程序的全名,但错误相同。我不知道这是否发送到商店可能会改变这一点(我不希望部署的另一个版本,越野车只是为了验证这一理论)

附加: 唯一的资源,我在网上找到关于这个问题是无用的并与Windows 8相关:link

建议?

+1

我有一个消耗品显示为IAPs溢价和标签是溢价和我使用的密钥也溢价。所以可能会使用点和其他符号在某个地方有一个错误,谁知道 –

+1

@JuanPabloGarciaCoello如果我只能在将应用程序提交到商店之前进行可靠的测试,那么我相信商店会修改软件包以包含应用程序内购买信息 – JBernardo

+0

在我的案例中,此消息'选择另一个项目'在IAP项目认证后的几天内显示。但后来,错误消息已经消失。 – pnp0a03

回答

5

经过两个月与微软的支持交谈,他们终于在他们身上修正了一些问题,我的IAP开始工作。

我相信修复是全球性的,但如果您的IAP仍然无法使用,请与他们联系以重新发布它。

下面是他们给我发电子邮件的摘录:

我们已经发布了在这个应用程式单边行动计划重新发布。这应该是 在过程完成后立即纠正这种情况。您可能希望 在接下来的几个小时内定期检查,看看您是否能够 确认修复工作适合您。让我知道你看到了什么。

+0

终于:)问题不在于代码然后:P – Razor

+0

是的,这是MS问题,新的应用程序仍然有空的ProductLicenses集合,但ProductListing包含产品,并且在WinPhone商店应用程序中查看时,新应用程序没有图标和屏幕截图。 – f14shm4n

4

请检查IAP的产品ID。我猜你在代码中提到的那个与商店中的不一样。

如果它相同,我建议使用方法LoadListingInformationAsync它返回IAP的列表,然后从该列表中选择所需的IAP。 如果名称不匹配,那么您将无法检索该IAP。所以我们可以找到它,因为命名问题。 我也添加了一个示例代码。试一下。

 try 
     { 
      var listing = await CurrentApp.LoadListingInformationAsync(); 
      var iap = listing.ProductListings.FirstOrDefault(p => p.Value.ProductId == "removeads"); 
      receipt = await CurrentApp.RequestProductPurchaseAsync(iap.Value.ProductId, true); 
      if (CurrentApp.LicenseInformation.ProductLicenses[iap.Value.ProductId].IsActive) 
      { 
       CurrentApp.ReportProductFulfillment(iap.Value.ProductId); 
       //your code after purchase is successful 
      } 
     } 
     catch (Exception ex) 
     { 
      //exception 
     } 
+0

问题是,就像我上面写的评论一样,我的'ProductListings'总是空的'IReadOnlyDictionary' ...我的仪表板上有3个IAP项目,并且它们都在几天前被标记为已发布。然而,我收到了一个空对象 – JBernardo

+0

,您是在新仪表板中创建了您的IAP吗?还是使用在旧仪表板中创建的对象?如果旧仪表板更新IAP并将其设置为可用的所有市场。看看MSDN ......看起来很多人都有这个问题。 [original MSDN post](https://social.msdn.microsoft.com/Forums/en-US/a44b7364-4017-4d98-ad40-dcc03dac4311/cant-find-item-in-catalog?forum=wpdevelop&prof=required) – Razor

+0

我在新的仪表板上创建了 – JBernardo

1

我相信这里的问题是您需要区分测试和生产。除非您在商店中发布,否则您无法使用生产模式。请参阅CurrentAppCurrentAppSimulator

CurrentAppSimiulator页:

备注

直到应用从Windows应用商店已经上市,CurrentApp对象将不会在应用程序工作。使用CurrentAppSimulator在开发应用程序时测试应用程序的许可和应用程序内产品。在测试应用程序之后,在将其提交到Windows应用商店之前,必须用CurrentApp替换CurrentAppSimulator的实例。如果使用CurrentAppSimulator,您的应用程序将无法通过认证。

这是我如何解决这个问题在我的应用程序与我的测试/生产改变的#define,那CurrentApp和CurrentAppSimulator之间切换,使我的其他代码的眼睛更容易的代理类。

App.xaml.cs,应用程序()

  // 
      // configure in-app purchasing 
      // 
#if false 
#warning WARNING: You are using CurrentAppProxy in TEST MODE! 
      CurrentAppProxy.SetTestMode(true); // true for test, false for production 
#else 
      CurrentAppProxy.SetTestMode(false); // true for test, false for production 

CurrentAppProxy.cs

public static class CurrentAppProxy 
{ 
    static bool? testmode = null; 
    public static async void SetTestMode(bool mode) 
    { 
     testmode = mode; 
     if (mode) 
     { 
      var file = await Package.Current.InstalledLocation.GetFileAsync("WindowsStoreProxy.xml"); 
      if (file != null) 
      { 
       await CurrentAppSimulator.ReloadSimulatorAsync(file); 
      } 
     } 
    } 

    public static LicenseInformation LicenseInformation 
    { 
     get 
     { 
      if (testmode == null) throw new NotSupportedException(); 
      else if (testmode.Value) return CurrentAppSimulator.LicenseInformation; 
      else return CurrentApp.LicenseInformation; 
     } 
    } 

    public static IAsyncOperation<IReadOnlyList<UnfulfilledConsumable>> GetUnfulfilledConsumablesAsync() 
    { 
     if (testmode == null) throw new NotSupportedException(); 
     else if (testmode.Value) return CurrentAppSimulator.GetUnfulfilledConsumablesAsync(); 
     else return CurrentApp.GetUnfulfilledConsumablesAsync(); 
    } 

    public static IAsyncOperation<ListingInformation> LoadListingInformationAsync() 
    { 
     if (testmode == null) throw new NotSupportedException(); 
     else if (testmode.Value) return CurrentAppSimulator.LoadListingInformationAsync(); 
     else return CurrentApp.LoadListingInformationAsync(); 
    } 

    public static IAsyncOperation<FulfillmentResult> ReportConsumableFulfillmentAsync(string productId, Guid transactionId) 
    { 
     if (testmode == null) throw new NotSupportedException(); 
     else if (testmode.Value) return CurrentAppSimulator.ReportConsumableFulfillmentAsync(productId, transactionId); 
     else return CurrentApp.ReportConsumableFulfillmentAsync(productId, transactionId); 
    } 

    public static IAsyncOperation<PurchaseResults> RequestProductPurchaseAsync(string productId) 
    { 
     if (testmode == null) throw new NotSupportedException(); 
     else if (testmode.Value) return CurrentAppSimulator.RequestProductPurchaseAsync(productId); 
     else return CurrentApp.RequestProductPurchaseAsync(productId); 
    } 
} 

在我的应用程序使用...

private async Task RefreshInAppOffers() 
    { 
     // in-app offers 
     List<KeyValuePair<string, ProductListing>> products = null; 
     UnfulfilledConsumable unfulfilledConsumable = null; 

     InAppOffers.Children.Clear(); 

     try 
     { 
      var listinginfo = await CurrentAppProxy.LoadListingInformationAsync(); 
      products = listinginfo.ProductListings.ToList(); 
      products.Sort((p1, p2) => p1.Value.FormattedPrice.CompareTo(p2.Value.FormattedPrice)); 

CurrentAppProxy是他们在这里的关键。如果它适用于模拟器,它应该适用于您的生产项目。你只需要为所有各种条件准备好所有其他部分。一些测试在调试器中最容易实现。

+1

事情是,我不能在生产中使用CurrentApp,很难相信即使我的应用程序已经发布,我也只能使用CurrentAppSimulator,即使我在商店上发布的应用程序的行为与CurrentApp的行为方式相同 – JBernardo

0

我有同样的问题。在我的情况下,解决方案是在IAP中添加所有语言描述,然后工作正常

+0

我试过了,但它没有工作 – JBernardo

0

我的新UWP应用程序“Midi Player”有类似的问题。 IAP在认证和发布后即可在WP 8.1上购买,但在W10M(Windows 10 Mobile)平台上显示同样的错误(我相信所有Windows 10 UWP应用都有相同的商店)。 我向微软公开了一个问题,但他们无法帮助我。幸运的是,现在的问题是走了:)我做了什么:

  • 公布的初步应用修订创建IAP
  • 测试IAP(适用于WP8.1,不工作的W10M)
  • 我发现我Package.appxmanifest文件略有变化(该字符串熔点:PhoneIdentity PhoneProductId = “7f32ab79-XXX-XXX-AFF3-ce228745b36f” PhonePublisherId = “00000000-0000-0000-0000-000000000000”)发布
  • 我改变了版本(次要号码),并提交新的版本更改Package.appxmanifest
  • 今天,我检查了W10M Lumia 950的IAP,它的工作原理。

所以,我的结论是:

  • 你需要创建IAP
  • 后重新发布应用您应该等待一点点
+0

我发布了e应用程序创建IAP(所有时间)后,等待两周... :( – JBernardo

+0

对不起,您是否尝试联系商店的客户支持? MS商店是有点儿越野车,我仍然有一对未解决的问题(并没有希望解决因为支持是非常不专业) – SeNS

+0

是的,支持是非常不专业的那里...我发布了[答案](http:///stackoverflow.com/a/34663266/754991)以我的经验 – JBernardo

1

我试了一下这个联系微软问题,他们要求我使IAP不可用,然后再次提供。 我必须说,它并没有解决我的问题,但如果你想给它一个尝试,请按照下列步骤操作:

  1. 的IAP
  2. 创建一个更新下的分配和可见性设置IAP为不可供购买
  3. 提交更新
  4. 等待更新发布
  5. 创建IAP
  6. 一个新的更新
  7. 集合分发和可见回可供购买
  8. 提交更新
  9. 一旦更新发布,复试IAP

之后,他们告诉我要尝试使整个应用程序无法使用到所有国家和发布。然后做相反的事情。没有成功...