升级到1.7 报错

ios下,报错信息如下,哪位大神知道这是什么原因吗
[ERROR] (/build/jsb-default/frameworks/cocos2d-x/cocos/scripting/js-bindings/auto/jsb_creator_auto.cpp, 315): wrong number of arguments: 1

查看源码是这里报错:

你代码中有调用 setSpriteFrame 么?是不是传入了非法值?你在js层调用setSpriteFrame前把第一个参数打印出来看看。

我搜索过了 没有直接调用setSpriteFrame 都是通过这种方式赋值的 zuanshi_img.spriteFrame = new cc.SpriteFrame(raw); 升级后才出的问题

提供个demo复现这个问题吧。

找到出问题的代码了,运行到最后一行,mask.type = cc.Mask.Type.IMAGE_STENCIL就会跑异常出来,1.5.2是正常的
var node = new cc.Node(“head_node”);
node.width = headImg.node.width;
node.height = headImg.node.height;
node.x = headImg.node.x;
node.y = headImg.node.y;
var mask = node.addComponent(cc.Mask);
mask.type = cc.Mask.Type.IMAGE_STENCIL;

基于helloworld,加上你的复现代码,整理一个demo给我们吧。

问题已解决了,将这行 mask.type = cc.Mask.Type.IMAGE_STENCIL;移到 mask.spriteFrame = new cc.SpriteFrame(raw);后面就不会报错了,1.5.2是正常的,1.7的web上也是正常的,附上demo

test.zip (264.5 KB)

好的,谢谢,我们查一下。

https://github.com/cocos-creator/cocos2d-x-lite/pull/994

早已经在这个PR中修复