Received memory warning. Level=2. Data Formatters temporarily unavailable, will re-try after a 'continue'
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=2and the application is crashing. giving the following message
Program received signal: “0”.
Data Formatters temporarily unavailabl开发者_StackOverflow社区e, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib")
alt text http://www.freeimagehosting.net/uploads/52ac11fe93.png
alt text http://www.freeimagehosting.net/uploads/619333a82f.png
This is cocos2d telling you that you are doing something wrong. You are calling setDirectorType
on the director in goToFirstScreen
, but the second time you call it there is already a director. I'm not sure why you are restarting the director. Why not just replace the scene:
-(void)goToFirstScreen:(id)sender
{
CCScene *Scene = [CCScene node];
CCLayer *Layer = [OpeningScreen node];
[Scene addChild:Layer];
[[CCDirector sharedDirector] replaceScene:Scene];
}
精彩评论