IAP mismatch docs vs api Cocos creator 2.0.7

IAP mismatch docs vs api Cocos creator 2.0.7
0
#1

according to docs to initialize IAP we should use

sdkbox.IAP.init();

github examples


use the same

but

in actual code looks like it uses

sdkbox.IAP.init(jsonconfig);

so i have a reference to sdkbox_config.json like this (inside of asset folders on build i manually copy it to res folder)

@property(cc.JsonAsset)
sdkBoxConfigJson=null;
get sdkBoxConfig(){return this.sdkBoxConfigJson.json}

but it crash because

IAP:Failed to get configuration

so how can i call to sdkbox.IAP.init(); without the parameter?

0 Likes

#2

Back to work after Chinese New Year now,

Thanks for your feedback, I check it ASAP.

0 Likes

#3

I checked with bellow code:

        if (cc.sys.isMobile) {
            sdkbox.PluginAdMob.init();


            console.log("sdkbox.firebase.Analytics.Param");
            console.log(sdkbox.firebase.Analytics.Param.kFIRParameterLevel);

            sdkbox.IAP.setDebug(true);
            sdkbox.IAP.setListener({
                onInitialized : function () {
                    console.log("sdkbox.IAP.onInitialized");
                },
            });
            sdkbox.IAP.init();
        }

iOS log:

2019-02-11 16:45:24.997134+0800 hello_world-mobile[85274:46468622] [MC] Reading from private effective user settings.
JS: sdkbox.firebase.Analytics.Param
JS: level
JS: sdkbox.IAP.onInitialized

so, it’s ok to invoke sdkbox.IAP.init();.

plz double check the /Users/admin/ccc207/build/jsb-link/res/sdkbox_config.json file.
Is the file contains iap in android:

https://jsoneditoronline.org/

A bug

I don’t know why, sometimes the sdkbox_config.json is empty after some op.
trying to reproduce this issue.

2019-03-04 UP
the sdkbox_config.json bug has been fixed.

0 Likes

#4

I have a same problems, Sdkbox guideline and sample both use the method as sdkbox.IAP.init()
but when i use init() method it always requires parameter is “jsonconfig” such as sdkbox.IAP.init(jsonconfig);. I don’t know how to use it :frowning:
I am newmem of cocos and using cocos creator 2.0.2 with typescript code

0 Likes

#5

use it whithout jsdonconfig

0 Likes

#6

Thank for ur answer, but i’m not understanding how to use it without jsonconfig, Please kindly explain more to help me :frowning:

0 Likes

#7

use the code in the docs.
for some reason typescript mark it as wrong but it compiles fine

0 Likes

#8

Oke, let me try it, thank for support, bro!

0 Likes

#9
sdkbox.IAP.init();

not work ?

0 Likes

#10

Hi yinjimmy, i used sdkbox.IAP.init() and worked well
Thank for ur support!

0 Likes