I am using cocos2d 0.99.4 and Xcode 4.0. so, I changed my AppDelegate in this way according to the documentation and example given in 0.99.4 version.
- (void) applicationDidFinishLaunching:(UIApplication*)application
{
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[CCDirector setDirectorType:kCCDirectorTypeDisplayLink];
CCDirector *director = [CCDirector sharedDirector];
[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
[director setAnimationInterval:1.0/60];
[director setDisplayFPS:NO];
EAGLView *glView = [EAGLView viewWithFrame:[window bounds]
pixelFormat:kEAGLColorFormatRGBA8
depthFormat:GL_DEPTH_COMPONENT24_OES
preserveBackbuffer:NO];
[[CCDirector sharedDirector] setOpenGLView:glView];
[window addSubview:glView];
[window makeKeyAndVisible];
[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
gameLevel = [[NSUserDefaults standardUserDefaults] integerForKey:@"gameLevel"] ;
gameLevel = 1;
CCScene *scene = [CCScene node];
CCLayer *layer = [GamewinScreen node];
[scene addChild :layer];
[[CCDirector sharedDirector] runWithScene: scene];
}
//The method test1 is also in the app Delegate class.
-(void)test1
{
[[CCDirector sharedDirector] end];
[[CCDirector sharedDirector] setOpenGLView:[[window subviews] objectAtIndex:0]];
CCScene *Scene = [CCScene node];
CCLayer *Layer = [OpeningScreen node];
[Scene addChild:Layer];
[[CCDirector sharedDirector] runWithScene: Scene];
}
In GameWinScreen I have a selector @selector(goToFirstScreen),
-(void)goToFirstScreen:(id)sender
{
[MY_DELEGATE performSelector:@selector(test1) withObject:nil afterDelay:1.0];
}
After playing the game for 50 minutes and more I am getting
Received memory warning. Level=1
for more than 10 times and then
Received memory warning. Level=2
and the application is crashing. giving the following message
Program received signal: “0”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib")