Ios 使用RoboVM的应用内pruchase解决方案是什么

Ios 使用RoboVM的应用内pruchase解决方案是什么,ios,libgdx,in-app-purchase,robovm,Ios,Libgdx,In App Purchase,Robovm,我想在我的iOS上的RoboVM应用程序上使用应用程序内购买。据我所知,我需要为此访问AppleStoreKit框架。我找到了以下解决方案: (标记为不赞成使用机器人) (…我找不到StoreKid绑定) (…是我不需要的跨平台解决方案) 我想知道对我来说最好的方法是什么。我首先尝试了gdx支付,但我不需要跨平台解决方案robovm ios绑定似乎只关注我需要的功能。但由于它被标记为不推荐使用,我对此表示怀疑robopods会很棒,因为它被RoboVM站点引用,但我在那里找不到StoreKi

我想在我的iOS上的RoboVM应用程序上使用应用程序内购买。据我所知,我需要为此访问AppleStoreKit框架。我找到了以下解决方案:

  • (标记为不赞成使用机器人)
  • (…我找不到StoreKid绑定)
  • (…是我不需要的跨平台解决方案)
我想知道对我来说最好的方法是什么。我首先尝试了gdx支付,但我不需要跨平台解决方案robovm ios绑定似乎只关注我需要的功能。但由于它被标记为不推荐使用,我对此表示怀疑robopods会很棒,因为它被RoboVM站点引用,但我在那里找不到StoreKid绑定

我试图找到一份关于如何使用其中一种技术的文档/教程。例如

  • 如何实施
  • 如何在不使用真实货币的情况下在模拟器上测试购买
  • 良好/不良做法、文档链接等

Gdx支付是最简单的方式。 包含实现它所需的所有信息

测试不能用真金白银完成。您可以设置测试环境以测试购买,如下所述:

苹果必须遵守的一条规则是在购买时要有一个“恢复”按钮。您的用户必须明确请求恢复其购买,例如在按钮上

以下是我如何设置Gdx Pay的示例:

if(PurchaseSystem.hasManager()){
        config = new PurchaseManagerConfig();
        config.addOffer(new Offer().setType(OfferType.ENTITLEMENT).setIdentifier(item1String));

        //Stores
        config.addStoreParam(PurchaseManagerConfig.STORE_NAME_ANDROID_GOOGLE, base64EncodedKey);
        config.addStoreParam(PurchaseManagerConfig.STORE_NAME_IOS_APPLE, base64EncodedKey); // <-- CHANGE KEY

        PurchaseSystem.install(new PurchaseObserver() {
            @Override
            public void handleInstall() {
                message(" - purchase manager installed: " + PurchaseSystem.storeName() + ".\n");
                // restore purchases
                message(" - do a restore to check inventory\n");

                //Execute this on a button instead!
                PurchaseSystem.purchaseRestore();
            }

            @Override
            public void handleInstallError(Throwable e) {
                message(" - error installing purchase manager: " + e + "\n");

                // throw error
                throw new GdxRuntimeException(e);
            }

            @Override
            public void handleRestore(Transaction[] transactions) {
                // keep note of our purchases
                message(" - totally " + transactions.length + " purchased products\n");
                for (int i = 0; i < transactions.length; i++) {
                    if(transactions[i].getIdentifier().equals(stone1)) {
                        preferences.putBoolean("item1_purchased", true);
                    }
                }

            }

            @Override
            public void handleRestoreError(Throwable e) {
                message(" - error during purchase manager restore: " + e + "\n");

                // throw error
                throw new GdxRuntimeException(e);
            }

            @Override
            public void handlePurchase(Transaction transaction) {
                message(" - purchased: " + transaction.getIdentifier() + "\n");

                // dispose the purchase system
                Gdx.app.postRunnable(new Runnable() {
                    @Override
                    public void run () {
                        message(" - disposing the purchase manager.\n");
                        PurchaseSystem.dispose();
                        message("Testing InApp System: COMPLETED\n");
                    }
                });
            }

            @Override
            public void handlePurchaseError(Throwable e) {
                message(" - error purchasing: " + e + "\n");
                // throw error
                throw new GdxRuntimeException(e);
            }

            @Override
            public void handlePurchaseCanceled() {
                message(" - purchase cancelled.\n");

                // dispose the purchase system
                Gdx.app.postRunnable(new Runnable() {
                    @Override
                    public void run () {
                        message(" - user canceled! - disposing the purchase manager.\n");
                        PurchaseSystem.dispose();
                        message("Testing InApp System: COMPLETED\n");
                    }
                });
            }
        },config);

    } else {
        //Toast an error
    }

进行购买。

我建议使用Gdx支付,无论是否跨平台。它仍然只能在iOS上运行。简单易用,谢谢!(我是唯一停止工作的旧绑定)。
PurchaseSystem.purchase("itemID");