according to docs to initialize IAP we should use
sdkbox.IAP.init();
github examples
var HelloWorldLayer = cc.Layer.extend({
sprite:null,
txtCoin:null,
menuIAP:null,
ctor:function () {
//////////////////////////////
// 1. super init first
this._super();
this.log("Sample Startup")
this.createTestMenu();
var winsize = cc.winSize;
var logo = new cc.Sprite("res/Logo.png");
var logoSize = logo.getContentSize();
logo.x = logoSize.width / 2;
logo.y = winsize.height - logoSize.height / 2;
This file has been truncated. show original
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?
Back to work after Chinese New Year
now,
Thanks for your feedback, I check it ASAP.
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
:
JSON Editor Online is a web-based tool to view, edit, format, transform, and diff JSON documents.
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.
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
I am newmem of cocos and using cocos creator 2.0.2 with typescript code
use it whithout jsdonconfig
Thank for ur answer, but i’m not understanding how to use it without jsonconfig, Please kindly explain more to help me
use the code in the docs.
for some reason typescript mark it as wrong but it compiles fine
Oke, let me try it, thank for support, bro!
Hi yinjimmy, i used sdkbox.IAP.init() and worked well
Thank for ur support!