Cocos Creator 3 SDKbox IAP plugin works only in debug build – Cocos Creator


Hi all, I decided to create a separate topic because think it is a bug.
So problem I faced is SDKbox IAP plugin in my case works only in DEBUG build…
Here is my code you can look what I do, just created debug console what is a label where I put my logs…
Then try to init IAP plugin and get products…

@ccclass("Main")
export class Main extends Component {
    @property(Label)
    private consoleDebug: Label = null;

    protected start() {
        const { consoleDebug } = this;

        console.log = function (...args) {
            consoleDebug.string += `n ${args}`;
        };

        if (typeof sdkbox !== undefined) {
            //@ts-ignore
            sdkbox.IAP.init();

            console.log("inited");

            sdkbox.IAP.refresh();

            console.log("refreshed");

            console.log(sdkbox.IAP.getProducts());
        }
    }
}

then I create two different builds… One with debug enabled and one with debug disabled and recorded video for you, you can look the result (sorry about quality, just took my old phone). In build with debug mode enabled, sdkbox.IAP.getProducts()
returns me an array with products you can see it in debug label console.
another one return empty array (you will see nothing in console as it is empty array):

Trying to make a purchase just will throw error in build without debug: incorrect item id, in build with debug will say: version of app isn’t convenient for purchases.



Source link

More To Explore

Share on facebook
Share on twitter
Share on linkedin
Share on email