本文介绍了在应用提交之前在iPhone上测试应用内购买的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个包含应用内购买的Cordova应用。
我已经在Android方面工作,所以流程正在工作。

I'm developing a Cordova app that contains in-app purchase.I've already got working the Android side, so the plugin flow is working.

现在我正在测试iOS方面,我无法正确获取产品:它们无效且不完整,似乎应用程序无法下载产品数据。

Now I'm testing the iOS side and I can't get products correctly: they are invalid and not complete, it seems the app is not able to download product data.


  1. 我在iTunes中定义了IAP(耗材)项目,相关的虚拟图像,并显示准备提交状态(黄色子弹)

  2. IAP产品也在新的应用版本页面中关联,尚未提交审核。

  3. 我在iTunes页面上看到此消息:您的第一个应用程序内购买必须使用新的应用程序版本提交。从应用程序的应用程序内购买部分中选择它,然后单击提交。

  4. 我正在使用app在真实设备上进行测试直接从XCode编译和安装并通过TestFlight

  1. I've defined IAP (consumable) items in iTunes, associated dummy image and they show "Ready to submit" status (yellow bullet)
  2. IAP products are also associated in the new app version page, not submitted for review yet.
  3. I see this message on an iTunes page: "Your first In-App Purchase must be submitted with a new app version. Select it from the app’s In-App Purchases section and click Submit."
  4. I'm testing on real device with app compiled and installed directly from XCode and through TestFlight

我检查了这个问题,但我没有找到明确的解决方案,我的问题是:为什么我无法从iTunes中正确下载我配置的产品?

I checked around for this problem but I did not found a clear solution, my question is: why I can't correctly download my configured products form iTunes?


  • 我必须在开始之前提交整个应用程序以获得IAP批准测试,或

  • 应该可以在本地测试(和获取产品)IAP的东西,而不需要Apple的任何应用程序提交/批准(在这可能是一个软件问题)?

我看不到该怎么办。提前感谢您的帮助。

I can't see what to do. Thanks in advance for any help.

更新

这是基本代码我正在使用这个,在iTunes上配置IAP产品:

Here is the basic code i'm using, with this plugin, to get IAP product configured on iTunes:

function storeInitialize() {
    store.register({
        id:     "creds_500",
        type:   store.CONSUMABLE
    });

    store.ready(function() {
        console.log("\\o/ STORE READY \\o/");
        console.log(JSON.stringify(store.get("creds_500")));
    });

    // When any product gets updated, refresh the HTML.
    store.when("product").updated(function(p) {
        console.info("Updating " + p.id);
        console.log(JSON.stringify(p));
    });    

    // Signal order errors
    store.when("product").error(function() {
        utils.userInfo("Il tuo ordine non è stato processato.");
    });

    // Load product data from the servers and restore whatever already have been purchased by the user.
    store.refresh();
}

这是使用iPhone 4s设备从safari控制台输出,安装来自XCode的应用程序:

And here is it's output from safari console using a iPhone 4s device, installing the app from XCode:

[Info] Updating creds_500
[Log] {"id":"creds_500","alias":"creds_500","type":"consumable","state":"invalid","title":null,"description":null,"priceMicros":null,"price":null,"currency":null,"loaded":true,"canPurchase":false,"owned":false,"downloading":false,"downloaded":false,"additionalData":null,"transaction":null,"valid":false}
[Info] Updating creds_500
[Log] {"id":"creds_500","alias":"creds_500","type":"consumable","state":"invalid","title":null,"description":null,"priceMicros":null,"price":null,"currency":null,"loaded":true,"canPurchase":false,"owned":false,"downloading":false,"downloaded":false,"additionalData":null,"transaction":null,"valid":false}
[Log] \o/ STORE READY \o/
[Log] {"id":"creds_500","alias":"creds_500","type":"consumable","state":"invalid","title":null,"description":null,"priceMicros":null,"price":null,"currency":null,"loaded":true,"canPurchase":false,"owned":false,"downloading":false,"downloaded":false,"additionalData":null,"transaction":null,"valid":false}

因此,几乎所有IAP字段都为空,包括价格,标题和描述(在iTunes端定义),产品无效不可购买。
我在其他帖子中发现,在Apple方面,不需要批准进行测试。

So, almost all IAP fields are null including price, title and description (defined in iTunes side) and products are "invalid" "not-purchasable". I found in other posts that on Apple side no approval is required for testing purpose.

我在哪里做错了?

推荐答案

我可以问你为什么使用那个特定的插件而不是另一个插件?它尚未在 8个月中更新,就Cordova应用而言,这意味着一生。

May I ask why are you using that particular plugin and not a different one? It hasn't been updated in 8 months, which in terms of Cordova apps, means a lifetime.

您的插件只有200颗星,虽然这个已经差不多800了,它已于2个月前更新。此外,它包括Windows Universal兼容性,我强烈建议您切换插件并重试。

Your plugin has only 200 stars, while this cordova-plugin-purchase has almost 800, and it was updated 2 months ago. Also, it includes Windows Universal compatibility, I strongly suggest you to switch plugins and retry.

这篇关于在应用提交之前在iPhone上测试应用内购买的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-09 21:26