我尝试设置标签并且它成功但是当我将 CCnode 插入 CCDictionary 并尝试获取 CCNode 并检查标签时,它是 0。
int tagNum = 242;
//Gem is class Gem :public CCNode , public CCTargetedTouchDelegate
Gem *thisGem = new Gem();
thisGem->retain();
thisGem->setTag(tagNum);
thisGem->initWithGame(this,zorder);
int t1 = thisGem->getTag();
// t1 = 242
//set in container
std::string gemID = thisGem->getGemId();
gemsDictionary->setObject(thisGem,gemID); //gemsDictionary init in the contracture
Gem *nextGemTest = (Gem *)gemsDictionary->objectForKey(gemID);
int t2 = nextGemTest->getTag();
// t2 is 0 ???