Js 读取csb文件报错 “Read design size error”

cocos2d-js-v3.2 + Cocos Code IDE v1.2.0 + cocos studio 2.0.6

用studio拼了一个 320*480 的界面,读取时候报错:

libpng warning: iCCP: known incorrect sRGB profile
cocos2d: Get data from file(UI/MenuLayer.csb) failed!
cocos2d: GetParseError Text only contains white space(s)

cocos2d: Read design size error!

Assertion failed: (IsObject()), function FindMember, file /Users/honghui/Documents/cocos/PrebuiltRuntimeJs/frameworks/runtime-src/proj.ios_mac/…/…/js-bindings/cocos2d-x/external/json/document.h, line 620.

config.json

  "init_cfg": {
    "isLandscape": false,
    "isWindowTop": false,
    "name": "CocosJSGameTest",
    "width": 320,
    "height": 480,
    "entry": "main.js",
    "consolePort": 6050,
    "uploadPort": 6060,
    "debugPort": 5086,
    "forwardConsolePort": 10088,
    "forwardDebugPort": 10086,
    "forwardUploadPort": 10090
  },

MenuLayer.js:

var MenuLayer = cc.Layer.extend({
    
    ctor:function(){
        this._super();
        var root =ccs.uiReader.widgetFromJsonFile("UI/MenuLayer.csb");
    },
    
});

不知道在哪儿修改

csb用ccs.load来加载

现在可以读取文件,但是添加到layer 中报错

        var root =ccs.csLoader.createNode("res/UI/MenuLayer.csb");
        
//        this.addChild(root,99,99);
        this.addChild(root);
cocos2d: suffix = csb
cocos2d: JS: /Users/qianuuu/dev/wkspace/cocoside/MoonPlane/runtime/mac/PrebuiltRuntimeJs.app/../../../src/layer/MenuLayer.js:16:Error: js_cocos2dx_Node_addChild : wrong number of arguments

和例子里 一样,像这样添加可以

        //add main node
        var mainNode = new cc.Node();
        var scale = 480 / 320;
        mainNode.attr({anchorX: 0, anchorY: 0, scale: scale, x: (320 - 480 * scale) / 2, y: (480 - 320 * scale) / 2});
        this.addChild(mainNode);

楼主用的啥版本的studio?

js现在只能解析json哦~~(难道这个csb是当初的protobuf= =?)

2.1版本的stduio已经可以导出json了,在设置里面可以设置成发布json。

cocos2d-js-v3.2 + Cocos Code IDE v1.2.0 + cocos studio 2.0.6 , 这个版本不能读取 csb 文件吗?2.1版本的stduio是不是 cocos3.4 的版本?

应该是不行的,建议用cocos2.1导出的json文件咯~:14: