I try to set tag and it does successfully but when i insert the CCnode in to CCDictionary and try to get the CCNode and checking the tag , its 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 ???
You can try to use std::map<std::string, Gem *>
instead of CCDictionary