Resource directory changes each time I test my app!

Resource directory changes each time I test my app!
0.0 0


I’ve run into a weird problem.

The first time I test my app, it will load retina graphics correctly

The next time I test my app, it will load the non-retina graphics

The loading is not random. It will alternate between retina and non-retina each test.
I produce these results on the iOS simulator, and also on my iPhone 4S

I followed the instructions for Centralized strategy on this page:

My directory looks like this:

I have tried moving the “iphone” and “iphone4” directories outside of the resources folder, no difference.

This is what my code looks like:

// AppDelegate.h
typedef struct tagResource
cocos2d::CCSize size;
@ char directory[100];@
} Resource;

static Resource smallResource = { cocos2d::CCSizeMake(320, 480), "iphone" }; static Resource mediumResource = { cocos2d::CCSizeMake(640, 960), "iphone4"}; static cocos2d::CCSize designResolutionSize = cocos2d::CCSizeMake(320, 480);


// AppDelegate.cpp
bool AppDelegate::applicationDidFinishLaunching()
@ // initialize director@
@ CCDirector pDirector = CCDirector::sharedDirector;@
pEGLView = CCEGLView::sharedOpenGLView();@

// Set the design resolution
pEGLView~~>setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionShowAll);

CCSize frameSize = pEGLView~~>getFrameSize;
// In this demo, we select resource according to the frame’s height.
// If the resource size is different from design resolution size, you need to set contentScaleFactor.
// We use the ratio of resource’s height to the height of design resolution,
// this can make sure that the resource’s height could fit for the height of design resolution.

// if the frame’s height is larger than the height of small resource size, select medium resource.
// if the frame’s height is smaller than the height of medium resource size, select small resource.
// turn on display FPS

// set FPS. the default value is 1.0/60 if you don’t call this
// create a scene. it’s an autorelease object
CCScene *pScene = HelloWorld::scene;
// run

return true;


I suspect that CCFileUtils::sharedFileUtils()->addSearchPath() has some side-effect that I’m not aware of. Can anyone assist?


I also want to add that sometimes the assets will mix and match. In this case the retina player appears, and the non-retina background appears:

I also tried a code change, using CCFileUtils::sharedFileUtils()->setSearchPaths() instead of CCFileUtils::sharedFileUtils()->addSearchPath(). Unfortunately, this had no effect.


I fixed it!

xcode groups DO NOT work!

xcode folder references DO work!