Cocos2d: Invalid Native Object

Cocos2d: Invalid Native Object
0.0 0


This is my code:
//load node file
var node = cc.BuilderReader.load(“the builder file”);

// node controller
var nodeController = function() {}
nodeController.prototype.onDidLoadFromCCB = function() {
It can work in the first time , but can not run second time. The error is

jsb_cocos2dx_auto.cpp: Line: 29599, Function: js_cocos2dx_CCSprite_setVisible
Cocos2d: Invalid Native Object

Please help me how to fix the issue.


i found the bug. Before the node is removed, i need to delete the spriteObject. The code like this:
nodeController.prototype.clear = function(){
delete this. spriteObject;
delete …
but i have to delete one more than param, it is not a good way.
Do you have any other ways?