• 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
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: NSTimer


  • Subject: RE: NSTimer
  • From: "Christopher Hickman" <email@hidden>
  • Date: Wed, 31 Aug 2005 15:35:12 -0400

According to
<http://developer.apple.com/documentation/Cocoa/Conceptual/Timers/index.html
> that's not the case:

"Note that run loops retain their timers, so you can release the timer after
you have added it to a run loop."

Since +scheduledTimerWithTimeInterval:invocation:repeats: adds it to the
default run loop, it should live past the end of this method just fine.

-----Original Message-----
From: cocoa-dev-bounces+tophu=email@hidden
[mailto:cocoa-dev-bounces+tophu=email@hidden] On Behalf Of Tom
Harrington
Sent: Wednesday, August 31, 2005 3:27 PM
To: Cocoa Mailing List
Subject: Re: NSTimer

On 8/31/05, Christopher Hickman <email@hidden> wrote:
[...]
>         incrementerTimer = [NSTimer scheduledTimerWithTimeInterval:seconds
>
invocation:incrementerInvocation
>
repeats:YES];
>
[...]
>         [NSTimer scheduledTimerWithTimeInterval:(seconds*iterations)
>                          invocation:[NSInvocation
invocationWithMethodSignature:
>                                                         [incrementerTimer
> methodSignatureForSelector:@selector(invalidate)]]
>                          repeats:NO];

These NSTimers are autoreleased, and are likely getting deallocated
before they can do anything.  You should retain them, keep a reference
to them, and then release them once you're done with them.

--
Tom Harrington
email@hidden
AIM: atomicbird1
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: NSTimer (From: Tom Harrington <email@hidden>)

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