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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:25:16+00:00 2026-05-15T16:25:16+00:00

I’ve got an iPhone app with an NSTimer called pressTimer that goes off every

  • 0

I’ve got an iPhone app with an NSTimer called pressTimer that goes off every time someone touches this button. The problem is they touch the button a lot, and I want the timer to stop when they lift up their finger. So I declared pressTimer in my .h and synthesized it in .m then assigned and started it on the TouchDown action I created. I use the code [pressTimer invalidate] on my TouchUpInside action that should cancel the timer, since it’s a global variable. It seems to cancel the timer fine, but then when I go to actually trip the timer, the program freezes up completely, even though I get no code errors or warnings. I’m a noob, so please don’t be too rough :0

Update: Console logs- Thanks guys!

continue
2010-07-01 16:39:30.981 Clickkr[1573:307] -[__NSCFData invalidate]: unrecognized selector sent to instance 0x154b40
2010-07-01 16:39:30.999 Clickkr[1573:307] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFData invalidate]: unrecognized selector sent to instance 0x154b40'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x309a5fd3 __exceptionPreprocess + 114
    1   libobjc.A.dylib                     0x318b58a5 objc_exception_throw + 24
    2   CoreFoundation                      0x309a9a77 -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
    3   CoreFoundation                      0x309a8f15 ___forwarding___ + 508
    4   CoreFoundation                      0x3093b680 _CF_forwarding_prep_0 + 48
    5   Clickkr                             0x00002b23 -[MyViewController addOne:] + 42
    6   CoreFoundation                      0x309307ad -[NSObject(NSObject) performSelector:withObject:withObject:] + 24
    7   UIKit                               0x31e1f829 -[UIApplication sendAction:to:from:forEvent:] + 84
    8   UIKit                               0x31e1f7c9 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
    9   UIKit                               0x31e1f79b -[UIControl sendAction:to:forEvent:] + 38
    10  UIKit                               0x31e1f4ed -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 356
    11  UIKit                               0x31e1fb3b -[UIControl touchesEnded:withEvent:] + 342
    12  UIKit                               0x31e1e4ed -[UIWindow _sendTouchesForEvent:] + 368
    13  UIKit                               0x31e1de67 -[UIWindow sendEvent:] + 262
    14  UIKit                               0x31e19b5b -[UIApplication sendEvent:] + 298
    15  UIKit                               0x31e19507 _UIApplicationHandleEvent + 5022
    16  GraphicsServices                    0x30a8c147 PurpleEventCallback + 666
    17  CoreFoundation                      0x3097baab __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
    18  CoreFoundation                      0x3097d84f __CFRunLoopDoSource1 + 166
    19  CoreFoundation                      0x3097e62d __CFRunLoopRun + 520
    20  CoreFoundation                      0x309278eb CFRunLoopRunSpecific + 230
    21  CoreFoundation                      0x309277f3 CFRunLoopRunInMode + 58
    22  GraphicsServices                    0x30a8b6ef GSEventRunModal + 114
    23  GraphicsServices                    0x30a8b79b GSEventRun + 62
    24  UIKit                               0x31dc32a7 -[UIApplication _run] + 402
    25  UIKit                               0x31dc1e17 UIApplicationMain + 670
    26  Clickkr                             0x00002333 main + 70
    27  Clickkr                             0x000022e8 start + 40
)
terminate called after throwing an instance of 'NSException'
Program received signal:  “SIGABRT”.
  • 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-15T16:25:16+00:00Added an answer on May 15, 2026 at 4:25 pm

    This is the way I invalidate timers:

    [timer invalidate];
    timer = nil;
    

    The problem you’re probably having is that once your timer is invalidated, it is removed from the runtime loop and when someone wants to access it, your program crashes. After invalidating it, just make it so that it is nil. That way if someone wants to send a message or do anything to it, it’ll send it to nil.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to loop through a bunch of documents I have to put
I'm making a simple page using Google Maps API 3. My first. One marker

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.