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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:12:31+00:00 2026-05-26T01:12:31+00:00

I schedule an NSTimer instance like this: [NSTimer scheduledTimerWithTimeInterval:.2 target:self selector:@selector(someMethod) userInfo:nil repeats:YES]; I

  • 0

I schedule an NSTimer instance like this:

    [NSTimer scheduledTimerWithTimeInterval:.2 target:self selector:@selector(someMethod) userInfo:nil repeats:YES];

I am able to call invalidate on my NSTimer to stop it from firing, but

    [NSTimer cancelPreviousPerformRequestsWithTarget:self];

does not stop the timer. I have checked and [NSRunLoop currentRunLoop] is exactly the same (as expected, these are in responses to user clicks) and of course the self instance is always the same. Why doesn’t cancel cancel?

  • 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-26T01:12:32+00:00Added an answer on May 26, 2026 at 1:12 am

    cancelPreviousPerformRequestsWithTarget: is an NSObject method, not an NSTimer method, and it is the inverse of NSObject’s performSelector: methods.

    [NSTimer cancelPreviousPerformRequestsWithTarget:self] is the same as [NSObject cancelPreviousPerformRequestsWithTarget:self], and what it cancels is any previous [self performSelector:… withObject:… afterDelay:…] messages. It has nothing to do with any NSTimer instances.

    Sending the message to the NSTimer class rather than the NSObject class works the same way that sending alloc to a class does. No classes override it; it works because NSObject’s implementation is inherited, and it does the same thing for the same reason.

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

Sidebar

Related Questions

I schedule a timer with NSTimer's function in viewWillAppear as follows: minutesTimer = nil;
I am trying to schedule NSTimer on a separate thread and this is how
I am trying to schedule a Job in Autosys and I would like this
I would like to schedule a batch job in which a can execute a
I would like to schedule a local notification to fire at 7pm everyday IF
I'm looking to schedule FTP file transfers, but to conserve bandwidth, I would like
I'm currently creating an alarm. I use NSTimer to schedule my alarms. My problem
I have a method that have input variable and I need to schedule this
I want to schedule a @selector(count) interval: 1.0f to count the time left. here
if([timer isValid]) // << breakpoint here { NSLog(@Timer Valid); } timer = [NSTimer scheduledTimerWithTimeInterval:[timeinterval

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.