Apple rejected my app because SDKBox IAP takes too long to appear

Apple rejected my app because SDKBox IAP takes too long to appear
0.0 0

#1

Today Apple rejected my app, because they said the IAP doesn’t showed up. I understand them, but that’s not totally true, the IAP does appear (the system dialog asking for the store password, and then the product price), but it takes too long. I’m using Cocos2d-js, and I’m not doing any fancy things, I just have an IAP product which is: “remove_ads”

I call it like this, after the parental gate is passed:

onParentalGranted: function(evt)
{      
            var evt = new cc.EventCustom(SHOW_WAIT_LAYER);
            cc.eventManager.dispatchEvent(evt);
            
            sdkbox.IAP.purchase("remove_ads");
}

I call an event to show a layer. The setup is done this way, in a helper.js file

sdkbox.IAP.init();
sdkbox.IAP.setListener({
            onSuccess : function (product) {
                //Purchase success
                var evt = new cc.EventCustom(PURCHASE_COMPLETED);
                cc.eventManager.dispatchEvent(evt);
            },
            
            onFailure : function (product, msg)
            {
                //Purchase failed
                //msg is the error message
                var evt = new cc.EventCustom(PURCHASE_ERROR);
                cc.eventManager.dispatchEvent(evt);

            },
            
            onCanceled : function (product)
            {
                //Purchase was canceled by user
                var evt = new cc.EventCustom(PURCHASE_CANCELLED);
                cc.eventManager.dispatchEvent(evt);
            },
            
            onRestored : function (product)
            {               
                var evt = new cc.EventCustom(PURCHASE_RESTORE);

                if (product.name == PURCHASE_ID)
                    evt.setUserData(0);
                else
                    evt.setUserData(1);
                    
                cc.eventManager.dispatchEvent(evt);

            }
 });

What can be the problem?


#2

Did you initialize SDKBOX IAP when your app starts, or when user is doing a purchase?
Because request your catalog from itune store takes time, so you want to initialize IAP as soon as your app starts.


#3

sdkbox.IAP.init(); right? Yes I did it, the big problem is that the IAP system dialog takes a lot of time to appear, so the app seems frozen.
As an example:

  1. I want to remove ads
  2. I press the “Remove ads” button
  3. Lot of time
  4. The system asks me to sign in to the store, or if I already signed in it asks me to buy the product.

#4

@nite asked if you did the init() when your app starts or when the user is doing a purchase

The suggestion is that if the delay could be being caused by the init() function, and running this at the start of the game allows the dialog to be shown quickly when the user wants to make a purchase.


#5

Are you making IAP::refresh() before later on trigger purchase? It is recommnded to do refresh on app launch… to get all your purchases info


#6

It would be great if there is a sample code that I can take a look at.

Here is our sample for IAP code, you can use that as a base.


#7

@nite I do the init() at the beginning, the code is not different to the samples… I just have the listener inside InitSDK()
@energyy I’ll try that, thanks!


#8

did you fix this issue?