【问题标题】:Testing iOS: Calling init() the first time an app is opened triggers 2 PURCHASE_CANCELLED events测试 iOS:第一次打开应用程序时调用 init() 会触发 2 个 PURCHASE_CANCELLED 事件
【发布时间】:2016-09-11 18:49:53
【问题描述】:

ios 用户帐户密码也会弹出。如果在应用程序仍处于打开状态时再次调用,则不会发生这种情况,但如果应用程序关闭并重新打开,则会重复。

谢谢

【问题讨论】:

    标签: in-app-billing distriqt


    【解决方案1】:

    听起来您有未完成的购买需要完成。

    在您的应用程序调用完成之前,购买将保持待处理状态。这是为了确保您的应用程序处理和验证购买。

    当您处理购买并交付产品或处理取消/失败时,您应该致电InAppBilling.service.finishPurchase

    https://gist.github.com/marchbold/851359b9e456e1a85d65#file-distriqt-extension-inappbilling-makepurchase-as

    private function purchase_cancelledHandler( event:PurchaseEvent ):void
    {
        // This transaction was cancelled so you should notify your user and finish the purchase
        trace( "purchase cancelled" + event.errorCode );
        if (event.data && event.data.length > 0)
            InAppBilling.service.finishPurchase( event.data[0] );
    }
    

    在启动时,您可以在SETUP_SUCCESS 事件之后检索待处理的购买:

    private function setupSuccessHandler( event:InAppBillingEvent ):void
    {
        var pending:Array = InAppBilling.service.getPendingPurchases();
        // Iterate over and handle as required
    }
    

    http://docs.airnativeextensions.com/inappbilling/docs/com/distriqt/extension/inappbilling/InAppBilling.html#getPendingPurchases()

    【讨论】:

    • getPendingPurchases() 会清除服务器上的待处理列表吗?
    • 不,在您对待处理的购买结果调用 finishPurchase 之前,它不会清除它们。
    • 我在设置成功时执行此操作,但 getProducts 调用似乎锁定了有效的产品 ID(未触发事件)'var pending:Array = InAppBilling.service.getPendingPurchases();对于每个 (var purchase:Purchase in pending) { InAppBilling.service.finishPurchase(purchase); } InAppBilling.service.getProducts( [ IAP_PRODUCT_ID ] );`
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多