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

  • Home
  • SEARCH
  • 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 6619749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:00:36+00:00 2026-05-25T21:00:36+00:00

I am having issue with invalidating a NSTimer . I initialize a NSTimer with

  • 0

I am having issue with invalidating a NSTimer.
I initialize a NSTimer with below function.

-(void) initLTTimer{
    [self shutLTTimer];
    [self setQuestion:questionCounter];
    isQuestionAttempt=NO;
    tmLeftTime=[NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(updateLeftTime:) userInfo:nil repeats:YES];
    NSLog(@"Timer Initialized");
}

further I called a function updateLeftTime in its selector.

- (void)updateLeftTime:(NSTimer *)theTimer {
    NSLog(@"%d",timeCounter);
    timeCounter+=1;
    tfLeftTime.text=[NSString stringWithFormat:@"%d", (QUESTION_TIME_LIMIT-timeCounter)];
    if (timeCounter>=QUESTION_TIME_LIMIT) {
        if (isQuestionAttempt==NO) {
            [self increaseDropShots];
        }
        [self setQuestionBg];
        timeCounter=0;
        [self shutLTTimer];
        [self updateQuestion:nil];
    }

}

This function [self increaseDropShots]; called in above function.
here is the code of this function

-(void)increaseDropShots
{
    NSString *imgName = @"DactiveRetake";
    if (IS_IPAD) {
        imgName = [imgName stringByAppendingString:@"_ipad"];
    }
    wrongAttemp+=1;
    for (int i =1; i<=wrongAttemp; i++ ) 
    {
        UIImageView *img=(UIImageView *)[self.view viewWithTag:i+50];
        [img setImage:[UIImage imageNamed:imgName]];
    }
    NSLog(@"Question dropped counter: %d",wrongAttemp);
    if (wrongAttemp == 3)
    {
        [self shutLTTimer];
        [CommonFunctions initGlobalVars];
        [Bgplayer stop];
        [Bgplayer release];

        OverPageViewController *opvc=[[OverPageViewController alloc] initWithNibName:[CommonFunctions getXIBFile:@"OverPageViewController"] bundle:[NSBundle mainBundle]];
        [self.navigationController pushViewController:opvc animated:YES];
        [opvc release];

    }

}

In this function I am killing this timer but I am unable.

   -(void) shutLTTimer{
    if ([tmLeftTime isValid]) {
        [tmLeftTime invalidate];
        tmLeftTime=nil;
    }

}
This is the whole scenario of my application

Please help me what is the issue.

  • 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-25T21:00:37+00:00Added an answer on May 25, 2026 at 9:00 pm

    Answered after conversation in comments

    Does the code definitely get to the line, [tmLeftTime invalidate];? You can check this by using a breakpoint or an NSLog.

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

Sidebar

Related Questions

Im having an issue with using prototypes observe function and gaining access to this
I am having issue with my js function within a ADF Faces af:interator .
Having an issue with random individuals trying to access an intranet site with a
Having an issue here that I have tried everything I can think of but
The issue I'm having is issue with is I'm trying to get the paintComponent
I'm having an issue with a query that currently uses LEFT JOIN weblog_data AS
I'm having an issue with my regex. I want to capture <% some stuff
I'm having an issue with a Flash/Flex erroring in Firefox but not IE. I
I’m having an issue where a drop down list in IE 6/7 is behaving
I am having an issue where Tomcat is treating extra path information as part

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.