I got segmentation fault when i execute this code:
void HelloWorld::loadCharacter(cocos2d::Size winS){
_spriteCache = SpriteFrameCache::getInstance();
for (int i = 1; i < 14; i++)
{
std::string num = StringUtils::format("%d", i);
Sprite *sprite = Sprite::create("head"+num+".tiff");
SpriteFrame *spriteFrame = SpriteFrame::createWithTexture(sprite->getTexture(),sprite->getTextureRect());
_spriteCache->addSpriteFrame(spriteFrame,"head"+num+".tiff");
_idlePlayer.pushBack(_spriteCache->getSpriteFrameByName("head"+num+".tiff"));
}
_idleAnimation = Animation::createWithSpriteFrames(_idlePlayer, 0.05f);
_idleAnimation->retain();
auto temp_sprite = Sprite::create();
temp_sprite->setAnchorPoint(Vec2(0.5,0.5));
temp_sprite->setPosition(Vec2(winS.width * 0.2, winS.height * 0.5));
temp_sprite->setScale(0.1);
this->addChild(temp_sprite);
auto walk = Animate::create(_idleAnimation);
temp_sprite->runAction(RepeatForever::create(walk));
}