Resource directory changes each time I test my app!

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:
http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Mechanism_of_loading_resources

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;@
@ CCEGLView
pEGLView = CCEGLView::sharedOpenGLView();@

pDirector~~>setOpenGLView;
// 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
{
CCFileUtils::sharedFileUtils~~>addSearchPath;
pDirector~~>setContentScaleFactor;
}
// if the frame’s height is smaller than the height of medium resource size, select small resource.
else
{
CCFileUtils::sharedFileUtils~~>addSearchPath;
pDirector~~>setContentScaleFactor;
}
// turn on display FPS
pDirector~~>setDisplayStats(true);

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

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!