Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6955997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:48:37+00:00 2026-05-27T14:48:37+00:00

after so much reading, i can see there is so much miss understanding on

  • 0

after so much reading, i can see there is so much miss understanding on what should i do when replacing scene.
on the dealloc method, do i have to release ALL my timers ?? or cocos2d does it ??

i have 3 timers on startup:

[self schedule: @selector(contact:)];
[self schedule:@selector(tick:)]; 
[self schedule: @selector(randomsActions:) interval:0.1];

befor i replace the scene to menu (replaceScene) i do this :

[self unschedule:@selector(randomsActions:)] ; //stop timer
    [self unschedule:@selector(contact:)] ; //stop timer
    [self unschedule:@selector(contact:)] ; //stop timer

but it crashes.(i have seen people saying i do not have to unschedule them? )

so i tried this in my dealloc :

[[CCScheduler sharedScheduler] unscheduleAllSelectorsForTarget: self];

which crash it also at the second time( crashes in class: CCScheduler.m )

in my dealloc i put also this:( DO I NEED TO??? )

delete _contactListener;
[self removeAllChildrenWithCleanup:
YES];
delete world;
world = NULL;
[super dealloc];

whats happen here ?
can someone give me any idea on what should be done in dealloc when replacing scenes?
what should i do with my timers ???

thanks .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:48:38+00:00Added an answer on May 27, 2026 at 2:48 pm

    When you replace the scene, COCOS2d automatically dealloc all the scheduler you have started for the particular scene or layer. Thats why you wrote [self scheduler:…];.
    Cocos2d Scheduler is somewhat different than NSTimer.

    You do not need to dealloc the sccheduler just keep it blank, need not to worry,

    - (void)dealloc {
    
        //memory deallocation  
    [super dealloc];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After much reading, I realized that Zend_Form can be divided into various representations, it
Currently trying at add ajax to a site, after much reading I discovered that
After much fiddling, I've managed to install the right ODBC driver and have successfully
So, I have a script called engine, and after much headbashing and (futile) debugging,
I have been reading several tutorials and watching some iTube videos to see how
I have spent the last few hours putting togeather the following code after reading
I have asked a similar question before here , but after much thought, and
It's a pleasure to see how much knowledge people have on here, it's a
After reading E-myth Revisited, I realize that I can do a better job at
After much research and trial and error I found how to store the items

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.