objective c - try to create CCSpriteFrame but get nil values -


i'm trying animate ccsprite in cocos2d v3 following question, i'm getting following error message in log:

    terminating app due uncaught exception 'nsinvalidargumentexception', reason: '*** -[__nsarraym  insertobject:atindex:]: object cannot nil' 

this code:

nsmutablearray *animationframes = [nsmutablearray array];     int framecount = 0;     for(int = 1; <= 9; ++i)     {         ccspriteframe *spriteframe = [[ccspriteframecache sharedspriteframecache] spriteframebyname: [nsstring stringwithformat:@"hero-%d.png", i]];              [animationframes addobject:spriteframe]; //error occur line          framecount++;         if (framecount == 8) break;     } 

the problem spriteframes nil, don't why. tested values nslog, , tried add hero-1.png ccsprite object , works fine. tried add fixed hero-1.png in frames verify if problem variable. didn't work also.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -