ios - 'NSInternalInconsistencyException: Do not initialize the TextureCache before the Director' -


to find solution have gone thru similar link: texturecache error cocos2d when integrated uikit app seems dealing error in different context..

question: have uikit project integrated cocos2d. when build, succeeds , runs but, @ times crashes after receiving memory warning error:

assertion failure in -[cctexturecache init], /users/myname/documents/csproject/csproject/libs/cocos2d/cctexturecache.m:90

terminating app due uncaught exception ‘nsinternalinconsistencyexception’, reason: ‘do not initialize texturecache before director’

the cocos2d scene run view controller when button touched , code given below:

in viewcontroller.m

-(ibaction)overtococos:(id)sender{     ccdirector *director = [ccdirector shareddirector];     ccglview *glview = [ccglview viewwithframe:cgrectmake(-100, -50, 480, 480)                                    pixelformat:keaglcolorformatrgba8                                    depthformat:0];     glview.opaque = no;     self.imagepicker.cameraoverlayview.userinteractionenabled = yes;     [self.imagepicker.cameraoverlayview insertsubview:glview atindex:0];     [self.imagepicker.cameraoverlayview bringsubviewtofront:glview];     [director setview:glview];     [director runwithscene:[helloworldlayer scene]]; } 

since crash occurs after receiving memory warning, tried

- (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of resources can recreated.     if ( [ ccdirector shareddirector ].view != nil ){         [[cctexturecache sharedtexturecache] removeunusedtextures];     }  } 

also added appdelegate's applicationdidreceivememorywarning. crash still exists.. please point me right direction handle error..

thanks in advance!


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -