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 6762467
In Process

The Archive Base Latest Questions

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

My timer not getting repeated please help here is the code timer = [NSTimer

  • 0

My timer not getting repeated please help

here is the code

timer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(doAnimation:) userInfo:nil repeats:YES];
[timer fire];

method

-(void)doAnimation:(id)Sender
{
}
  • 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-26T14:19:49+00:00Added an answer on May 26, 2026 at 2:19 pm

    [timer fire] manually fires the timer only once and is not actually “starting” the timer. From the docs:

    You can use this method to fire a repeating timer without interrupting its regular firing schedule. If the timer is non-repeating, it is automatically invalidated after firing, even if its scheduled fire date has not arrived.

    You need to add the timer in a run loop before it will start firing and repeating:

    You must add the new timer to a run loop, using addTimer:forMode:. Then, after seconds seconds have elapsed, the timer fires, sending the message aSelector to target. (If the timer is configured to repeat, there is no need to subsequently re-add the timer to the run loop.)

    An easier way would be to do something like:

    timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(doAnimation:) userInfo:nil repeats:YES];
    

    and:

    -(void)doAnimation:(NSTimer*)timer
    {
    }
    

    This automatically schedules the timer and adds it to the run loop. Just in case you aren’t doing it, as you have set the target to be self you have to make sure the method doAnimation is defined within the same class.

    NSTimer Class Reference

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the below code TextBox value is not getting cleared after clicking on Button.
I am not getting why the colon shifted left in the second time >>>
I'm getting the error: wintypes.dcu not found several times a day in the Delphi
I keep getting the error: Type was not found or was not a compile-time
I have a timer that needs to not process its elapsed event handler at
I simply do not understand why both works: this.timer.Tick += new EventHandler(timer_Tick); this.timer.Tick +=
From MSDN: The CancelWaitableTimer function does not change the signaled state of the timer.
Is there a way of calling a method/lines of code multiple times not using
I am trying to pass current object reference i.e. self to the Timer class
SetTimeout is not working for the follwing code: $(#clkDblClk).click(function(){ var clickTimer=setTimeout(function(){ //Some code to

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.