I am attempting to use CCSpriteFrameCache instead of just loading my images from files seperatly. I am using texturepacker to produce 2 files called
sprites.plst and
sprites.png
I then use these 2 lines of code to try to load them in the init function of my scene…
CCSpriteFrameCache::sharedSpriteFrameCache()>init;>addSpriteFramesWithFile;
CCSpriteFrameCache::sharedSpriteFrameCache
When I do the program crashes with a exc_bad_access error. The source of the error is CCSpriteFrameCache::addSpriteFramesWithDictionary line 101. Here…
<pre>
void CCSpriteFrameCache::addSpriteFramesWithDictionary
{
/*
Supported Zwoptex Formats:
ZWTCoordinatesFormatOptionXMLLegacy = 0, // Flash Version
ZWTCoordinatesFormatOptionXML1_0 = 1, // Desktop Version 0.0~~ 0.4b
ZWTCoordinatesFormatOptionXML1_1 = 2, // Desktop Version 1.0.0~~ 1.0.1
ZWTCoordinatesFormatOptionXML1_2 = 3, // Desktop Version 1.0.2+
/
CCDictionarymetadataDict = (CCDictionary*)dictionary~~>objectForKey;
CCDictionary *framesDict = dictionary~~>objectForKey(“frames”);
int format = 0;
// get the format
if(metadataDict != NULL)
{
format = metadataDict->valueForKey(“format”)~~>intValue;
}
// check the format
CCAssert;
CCDictElement* pElement = NULL;
CCDICT_FOREACH <~~this is the line of the crash. framesDict is NULL which I imagine is why it’s crashing but I don’t know how to fix it.
{