Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Patrick

I am trying the Ejecta IAP example. So I copied the example and made it another class, and setup the products in iTunes Connect. Sure the bundle id is correct and so are the product IDs.

When I call the purchase function, it crashed while retrieving the product infos!

Am I missing anything important?



Here are the console logs:
=====================

2013-08-08 19:08:27.493 Test App[683:707] IAP: Requesting product info: TestTokens

Thread dump logs
=====================
Thread1: EXC_BAD_ACCESS
at the statement JSValueUnprotectSafe inside EJBindingIAPManager.m

- (void)dealloc {
for( NSValue *v in productRequestCallbacks ) {
JSValueUnprotectSafe(scriptView.jsGlobalContext, v.pointerValue);
}
[productRequestCallbacks release];


Here are my codes:
=====================
//
// iap.js
//
ig.module(
	'game.iap'
)
.defines(function(){

Iap = ig.Class.extend({

    init: function()
    {
    },

    purchase: function( productId )
    {
        var iap = new Ejecta.IAPManager();
        var productIds = [productId];

        iap.getProducts( productIds,
            function(error, products)
            {
                if( error )
                {
                    console.log( error );
                }
                else
                {
                    var selectedProduct = null;
                    for( var i = 0; i < products.length; i++ )
                    {
                        console.log(
                            products[i].id,
                            products[i].title,
                            products[i].description,
                            products[i].price
                        );

                        if( products[i].id == productId )
                        {
                            selectedProduct = products[i];
                        }
                    }

                    // Buy that token iAP product
                    selectedProduct.purchase(1,
                        function(error, transaction)
                        {
                            if( error )
                            {
                                console.log(error);
                            }
                            else
                            {
                                // Purchase successful; log some transaction info
                                console.log(
                                    transaction.productId,
                                    transaction.id,
                                    transaction.receipt
                                );
                            }
                        }
                    );

                }
            }
        );
    },
});
});

10 years ago by Reinaldo

I'm experiencing the same issue. Has anyone figured it out yet?
Page 1 of 1
« first « previous next › last »