• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTimer +timerWithTimeInterval:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTimer +timerWithTimeInterval:


  • Subject: Re: NSTimer +timerWithTimeInterval:
  • From: Steve Mills via Cocoa-dev <email@hidden>
  • Date: Wed, 29 Apr 2020 15:43:46 -0500

On Apr 29, 2020, at 15:36:23, Carl Hoefs via Cocoa-dev
<email@hidden> wrote:
>
> When I issue NSTimer's +timerWithTimeInterval::::: method, I'm getting
> unexpected timer firing times (20X faster than expected).
>
> ∙ If I specify 1.0 for the time interval, my method gets called 20 times/sec.
> ∙ If I specify 20.0 for the time interval, my method gets called 1 time/sec.
> ∙ If I specify 100.0 for the time interval, my method gets called 5 times/sec.
> ...etc.
>
> Here is my only invocation, called once and nevermore:
>
>        NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.0  // should be
> 1/sec
>                                                    target:self
>                                                  selector:@selector(newData:)
>                                                  userInfo:nil
>                                                   repeats:YES];
>        [[NSRunLoop mainRunLoop] addTimer:newTimer
>                                  forMode:NSRunLoopCommonModes];

Sounds like multiple timers are being installed. Set a breakpoint that logs
when hit.

--
Steve Mills
Drummer, Mac geek

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSTimer +timerWithTimeInterval:
      • From: Carl Hoefs via Cocoa-dev <email@hidden>
References: 
 >NSTimer +timerWithTimeInterval: (From: Carl Hoefs via Cocoa-dev <email@hidden>)

  • Prev by Date: Re: NSTimer +timerWithTimeInterval:
  • Next by Date: Re: NSTimer +timerWithTimeInterval:
  • Previous by thread: Re: NSTimer +timerWithTimeInterval:
  • Next by thread: Re: NSTimer +timerWithTimeInterval:
  • Index(es):
    • Date
    • Thread