Breaking News
Home / iOS / iOS Snippets / How to clean Cocos2d cache?

How to clean Cocos2d cache?


The Cocos2D framework  caches a lot of objects in memory like Textures, Sprites etc. to application increase performance by avoiding repititive loading overheads.

When the device is about to run out of memory the iOS would invoke the applicationDidReceiveMemoryWarning handler. It is then we can invoke the  following methods on the Cocos2D framework to purge/remove the cache data as follows:

– (void)applicationDidReceiveMemoryWarning:(UIApplication *)application

[[CCTextureCache sharedTextureCache] removeUnusedTextures];
    [[CCDirector sharedDirector] purgeCachedData];


Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Leave a Reply