Re: [OT] NSTimer +timerWithTimeInterval:

2020-05-04 Thread Glenn L. Austin via Cocoa-dev
ARC uses the analyzers rules. I was told that if you trust the analyzer (and follow it's rules), ARC will be fine. I have a few pieces of code that the analyzer was unhappy with, bugs had been submitted, but they were primarily with C++ code wrapping CF objects. -- Glenn L. Austin, Computer Wi

Re: NSTimer +timerWithTimeInterval:

2020-05-04 Thread Dave via Cocoa-dev
Hi, I’d try this: Make a method called setupTimer with the code below. Then in applicationDidFinishLaunching call performSelector: setupTimer with a delay of (say 5 seconds). Just to see if it changes anything…. Cheers Dave > On 29 Apr 2020, at 23:35, Carl Hoefs via Cocoa-dev > wrote: >

Re: [OT] NSTimer +timerWithTimeInterval:

2020-05-03 Thread Dave via Cocoa-dev
Yes, that’s correct, nothing wrong with a method beginning with new as long as it follows the rules, I use it all the time. I’m not sure if it matters at all with ARC, but I stick by the rules anyway. Cheers Dave > On 30 Apr 2020, at 00:27, Sandor Szatmari via Cocoa-dev > wrote: > > Alex, >

Re: [OT] NSTimer +timerWithTimeInterval:

2020-04-30 Thread Martin Wierschin via Cocoa-dev
prefix new one must ensure >> that the method followed memory management conventions, and would return an >> object with a +1 retain count. Am I mistaken about this? >> >> Sandor >> >>> >>>>> On Apr 29, 2020, at 4:07 PM, Carl Hoefs via Co

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
Cosmic rays? Disk corruption? Tired bits? Embedded escapes? Xcode cruft? Whatever the bug-a-boo was, with a freshly reinstalled Xcode (11.2.1) and command line tools, it's gone! I blew everything away and rebuilt the project and It Just Works™️. Thanks for all the support. Sorry for the noise!

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Chris Walters via Cocoa-dev
)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.0 // should be 1/sec target:self selector:@selector(newData:) userInfo:nil repeats:YES]; CFTimeInterval newTimerIntervalFromCF

Re: [OT] NSTimer +timerWithTimeInterval:

2020-04-29 Thread Alex Zavatone via Cocoa-dev
followed memory management conventions, and would return an > object with a +1 retain count. Am I mistaken about this? > > Sandor > >> >>>> On Apr 29, 2020, at 4:07 PM, Carl Hoefs via Cocoa-dev >>>>

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Ken Thomases via Cocoa-dev
dded a >> newData: method. This is with Xcode 11.2.1 on Mojave, 10.4.6. Works fine >> for me. Weird! >> >> @implementation AppDelegate >> >> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { >>NSTimer *newTimer = [N

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread John Bishop via Cocoa-dev
and instrument its creation (NSLog or equiv.) which might help debug whether its the timer or how it's added or perhaps how the caller is threaded... @property (nonatomic, assign) NSTimer *myOneSecondTimer; [self.myOneSecondTimer invalidate]; self.myOneSecondTimer = [NSTimer s

Re: [OT] Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Ken Thomases via Cocoa-dev
On Apr 29, 2020, at 5:27 PM, Sandor Szatmari via Cocoa-dev wrote: > >> On Apr 29, 2020, at 17:12, Alex Zavatone via Cocoa-dev >> wrote: >> >> Not sure about this, but in Objective-C, you’re not supposed to start >> methods with new. > > I’ve always operated under the premise that using a r

[OT] Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Sandor Szatmari via Cocoa-dev
r, if one chose the prefix new one must ensure that the method followed memory management conventions, and would return an object with a +1 retain count. Am I mistaken about this? Sandor > >>> On Apr 29, 2020, at 4:07 PM, Carl Hoefs via Cocoa-dev >>> wrote

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Keary Suska via Cocoa-dev
added a >> newData: method. This is with Xcode 11.2.1 on Mojave, 10.4.6. Works fine >> for me. Weird! >> >> @implementation AppDelegate >> >> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { >>NSTimer *new

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Alex Zavatone via Cocoa-dev
For giggles, comment out the current code and replace it with exactly the same code. Or put it in a new class and call the new class. > On Apr 29, 2020, at 4:45 PM, Carl Hoefs via Cocoa-dev > wrote: > > When everything goes wonky... it's time to reinstall all of Xcode...! > > *sigh* > -Car

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Rob Petrovec via Cocoa-dev
I thought when everything goes wonky you zap the PRAM and rebuild the Desktop? —Rob > On Apr 29, 2020, at 3:45 PM, Carl Hoefs via Cocoa-dev > wrote: > > When everything goes wonky... it's time to reinstall all of Xcode...! > > *sigh* > -Carl > > > __

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
When everything goes wonky... it's time to reinstall all of Xcode...! *sigh* -Carl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
Xcode 11.2.1 on Mojave, 10.4.6. Works fine > for me. Weird! > > @implementation AppDelegate > > - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { > NSTimer *newTimer = [NSTimer timerWithTimeIn

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Alex Zavatone via Cocoa-dev
Just ot be safe, reboot your Mac to make sure that things aren’t completely borked. I’ve had to do this many times. > On Apr 29, 2020, at 4:26 PM, Carl Hoefs > wrote: > > I accept that NSTimer works as documented! But I allege there must be > something odd about my (inh

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
I accept that NSTimer works as documented! But I allege there must be something odd about my (inherited) project that I can't quite put my finger on. Perhaps the +timerWithTimeInterval: method is overridden... -Carl > On Apr 29, 2020, at 2:15 PM, Alex Zavatone wrote: > > I use

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Alex Zavatone via Cocoa-dev
t;>>> 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. >>>>

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Alex Zavatone via Cocoa-dev
Not sure about this, but in Objective-C, you’re not supposed to start methods with new. > On Apr 29, 2020, at 4:07 PM, Carl Hoefs via Cocoa-dev > wrote: > >>>> NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
pecify 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: >>

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
times/sec. >> ...etc. >> >> Here is my only invocation, called once and nevermore: >> >> NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.0 // should be >> 1/sec >>

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Steve Mills via Cocoa-dev
d 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 = [N

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Alex Zavatone via Cocoa-dev
...etc. > > Here is my only invocation, called once and nevermore: > >NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.0 // should be > 1/sec >target:self >

NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
ec. ∙ 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 t

Re: NSTimer not firing when computer is inactive for a while.

2017-11-14 Thread Jens Alfke
> On Nov 14, 2017, at 4:43 PM, Nathan Day wrote: > > The background app is kept alive by launchd as a User Agent and looks for new > resources to be downloaded periodically If this is a launchd agent, you can configure its plist so it gets launched periodically. That way it won’t have to kee

Re: NSTimer not firing when computer is inactive for a while.

2017-11-14 Thread Quincey Morris
On Nov 14, 2017, at 16:57 , Quincey Morris wrote: > > I would suggest you try setting the QoS to at least “utility”, perhaps even > “user initiated”. To clarify: *what* you set to a different QoS depends on the nature of the thing you described as a “background process”. For example, if you’r

Re: NSTimer not firing when computer is inactive for a while.

2017-11-14 Thread Quincey Morris
On Nov 14, 2017, at 16:43 , Nathan Day wrote: > > I have a background process that uses an NSTimer that is set to fire every > minute, but when the computer is inactive for a while it will stop firing My guess is that it’s not a problem with the timer, but with the quality of service

Re: NSTimer not firing when computer is inactive for a while.

2017-11-14 Thread Nathan Day
I should make it clear, this is a Mac OS X application. Nathan Day On 14 Nov, 2017, at 01:43 PM, Nathan Day wrote: I have a background process that uses an NSTimer that is set to fire every minute, but when the computer is inactive for a while it will stop firing, its not until someone

NSTimer not firing when computer is inactive for a while.

2017-11-14 Thread Nathan Day
I have a background process that uses an NSTimer that is set to fire every minute, but when the computer is inactive for a while it will stop firing, its not until someone interacts with the computer the timer will start firing again. The timer is added to the main NSRunLoop, maybe the

Re: Problem using NSTimer in privileged helper tool

2017-10-22 Thread Uli Kusterer
On 19. Oct 2017, at 18:04, Mark Allan wrote: > So I tried refactoring the block into a separate method and using an older > NSTimer method: > [NSTimer timerWithTimeInterval:0.2 target:self > selector:@selector(updateTheDelegateForRunID:) userInfo:runID repeats:YES]; > >

Re: Problem using NSTimer in privileged helper tool

2017-10-21 Thread Jean-Daniel
> Le 20 oct. 2017 à 18:56, Quincey Morris > a écrit : > > On Oct 20, 2017, at 03:23 , Mark Allan wrote: >> >> That worked with the block-based NSTimer API but not the selector-based API. >> I tried changing it to 'currentRunLoop' which got rid of

Re: Problem using NSTimer in privileged helper tool

2017-10-20 Thread Jens Alfke
> On Oct 20, 2017, at 9:56 AM, Quincey Morris > wrote: > > — When you scheduled the timer on the main run loop, it was actually being > scheduled on the main app’s run loop. When it was block based, only the block > had to be passed across the XPC interface (which somehow works), but when it

Re: Problem using NSTimer in privileged helper tool

2017-10-20 Thread Quincey Morris
On Oct 20, 2017, at 03:23 , Mark Allan wrote: > > That worked with the block-based NSTimer API but not the selector-based API. > I tried changing it to 'currentRunLoop' which got rid of the crash, but the > timer never fired. This is pure guesswork, but I suspect thi

Re: Problem using NSTimer in privileged helper tool

2017-10-20 Thread Mark Allan
ly, I thought this meant my own class needed to conform to >> NSSecureCoding, but after some failed attempts, it think it's trying to tell >> me that it can't do it because *NSTimer* doesn't conform to NSSecureCoding. >> Is that correct, and if so does anyone kn

Re: Problem using NSTimer in privileged helper tool

2017-10-20 Thread Mark Allan
interface to > the main app. What does the backtrace look like? Ideally there would be > something there that tells you what it’s trying to do at that time. > > I don’t know, but I suspect that the block-based NSTimer methods might differ > from the selector-based ones in t

Re: Problem using NSTimer in privileged helper tool

2017-10-19 Thread Quincey Morris
at that time. I don’t know, but I suspect that the block-based NSTimer methods might differ from the selector-based ones in that they use GCD rather than the run loop. If you look at the documentation, the old methods say "schedules it on the current run loop”. The new methods

Re: Problem using NSTimer in privileged helper tool

2017-10-19 Thread Alex Zavatone
unicates these back to the main app. > > The main app communicates with the helper tool via NSXPCConnection. > > I'm using an NSTimer to send the update messages to the delegate with the > following incantation: > >[NSTimer timerWithTimeInterval:0.2 repeats:YES block:^(N

Problem using NSTimer in privileged helper tool

2017-10-19 Thread Mark Allan
o the main app. The main app communicates with the helper tool via NSXPCConnection. I'm using an NSTimer to send the update messages to the delegate with the following incantation: [NSTimer timerWithTimeInterval:0.2 repeats:YES block:^(NSTimer * _Nonnull timer) { ... }]; This works

Re: NSTimer or what?

2017-06-20 Thread Gerriet M. Denkmann
> On 20 Jun 2017, at 16:24, Alastair Houghton > wrote: > > On 20 Jun 2017, at 04:04, Gerriet M. Denkmann wrote: >> > >> 2. some other thing repeatedly about every 0.1 second. > > Personally, I’d choose an API that directly supports repeating ti

Re: NSTimer or what?

2017-06-20 Thread Gerriet M. Denkmann
use so much as whether you want to be able > to cancel the operation. If you need to be able to cancel it before it > fires, you’ll want to use NSTimer or a CFRunLoopTimer. I indeed need the things to cancel: The app might schedule a thing to be done in 5 seconds, then decides after 2 seco

Re: NSTimer or what?

2017-06-20 Thread Alastair Houghton
before it fires, you’ll want to use NSTimer or a CFRunLoopTimer. Energy wise, the fact this is to happen “a few seconds later” would seem to imply that it isn’t going to happen often, so it’s probably irrelevant and which you choose is a matter of taste. > 2. some other thing repeatedly abou

Re: NSTimer or what?

2017-06-19 Thread Quincey Morris
On Jun 19, 2017, at 20:04 , Gerriet M. Denkmann wrote: > > What is the most efficient (energy-wise) way to do this: > > NSTimer (with tolerance) > NSRunLoop performSelector:target:argument:order:modes: > NSObject performSelector:withObject

NSTimer or what?

2017-06-19 Thread Gerriet M. Denkmann
macOS 11+ Some Cocoa app which has to do: 1. something a few seconds later 2. some other thing repeatedly about every 0.1 second. What is the most efficient (energy-wise) way to do this: NSTimer (with tolerance) NSRunLoop performSelector:target:argument:order:modes: NSObject

Re: NSTimer after Sleep

2016-04-29 Thread Alex Kac
). > On Apr 29, 2016, at 3:23 AM, Gerriet M. Denkmann wrote: > > OS X 10.11.4; Xcode Version 7.3 (7D175). > > self.timer = [ NSTimer scheduledTimerWithTimeInterval: 900 … repeats: YES ]; > self.timer.fireDate = [ NSDate dateWithTimeIntervalSinceNow: ]; > > works fine

NSTimer after Sleep

2016-04-29 Thread Gerriet M. Denkmann
OS X 10.11.4; Xcode Version 7.3 (7D175). self.timer = [ NSTimer scheduledTimerWithTimeInterval: 900 … repeats: YES ]; self.timer.fireDate = [ NSDate dateWithTimeIntervalSinceNow: ]; works fine without sleep. But: fireDate: Fri 29 Apr 2016 15:06:14 +0700 in 37.03 min +900 sec Fri 29 Apr

Re: Smarter NSTimer?

2014-07-01 Thread John Pannell
14, at 12:21 PM, William Squires wrote: > What would be the best way to make an NSTimer that could pause/un-pause its > timing? Subclassing? Containment? Just roll my own with > performWithSelector:afterDelay:? That is, if I (my code) creates a (smart) > NSTimer with a duration of 5

Re: Smarter NSTimer?

2014-07-01 Thread Alex Zavatone
It seems like he wants a set of expire events where certain events will fire independent of whether the timer is paused or not. It might be possible to have a global timer for these decorations and each object has a durationUntilExpiration, which is the global timer + the object's duration of e

Re: Smarter NSTimer?

2014-07-01 Thread Quincey Morris
On Jul 1, 2014, at 11:21 , William Squires wrote: > Use-case: > I have a (fictitious) FPS game in which the players or bots can "damage" the > scenery by leaving blast marks. A timer should remove these "decorations" > after a given delay, but I want the timers to pause if any players/bots are

Re: Smarter NSTimer?

2014-07-01 Thread Alex Zavatone
way to make an NSTimer that could pause/un-pause its > timing? Subclassing? Containment? Just roll my own with > performWithSelector:afterDelay:? That is, if I (my code) creates a (smart) > NSTimer with a duration of 5 seconds, then three seconds later I need to > pause the timer, t

Re: Smarter NSTimer?

2014-07-01 Thread ChanMaxthon
would be the best way to make an NSTimer that could pause/un-pause its > timing? Subclassing? Containment? Just roll my own with > performWithSelector:afterDelay:? That is, if I (my code) creates a (smart) > NSTimer with a duration of 5 seconds, then three seconds later I need to >

Smarter NSTimer?

2014-07-01 Thread William Squires
What would be the best way to make an NSTimer that could pause/un-pause its timing? Subclassing? Containment? Just roll my own with performWithSelector:afterDelay:? That is, if I (my code) creates a (smart) NSTimer with a duration of 5 seconds, then three seconds later I need to pause the

Re: NSTimer invalidation...

2014-06-09 Thread Graham Cox
On 10 Jun 2014, at 8:01 am, Peters, Brandon wrote: > Is it safe to invalidate a timer from within the timer callback function? Yes. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator co

NSTimer invalidation...

2014-06-09 Thread Peters, Brandon
Is it safe to invalidate a timer from within the timer callback function? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.ap

Re: Could somebody please fix NSTimer?

2013-01-15 Thread Gordon Apple
In case anybody is interested, the following wrapper for NSTimer solves the problem. (You can add the other methods yourself, if needed.) #import @interface RTPTimer : NSObject @property(nonatomic, weak) id target; @property(nonatomic) SEL sel; + (RTPTimer *)scheduledTimerWithTimeInterval

Re: Could somebody please fix NSTimer?

2013-01-14 Thread Laurent Daudelin
s that point at objects in other parts of his app that >>> know nothing of the timers' existence, this sounds like a fragility >>> nightmare. >>> >>> The NSTimer ship has sailed. >> >> I don't really see it. All you'd need woul

Re: Could somebody please fix NSTimer?

2013-01-14 Thread William Sumner
f the timers' existence, this sounds like a fragility >> nightmare. >> >> The NSTimer ship has sailed. > > I don't really see it. All you'd need would be a special initializer or > convenience constructor, like +[NSMapTable strongToWeakObjectsMapTable]

Re: Could somebody please fix NSTimer?

2013-01-14 Thread Charles Srstka
On Jan 14, 2013, at 5:45 PM, Charles Srstka wrote: > Make versions of the +timerWithTimeInterval:etc:etc: classes That obviously should be methods, not classes. Sorry; I've had a long day. Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.co

Re: Could somebody please fix NSTimer?

2013-01-14 Thread Charles Srstka
On Jan 14, 2013, at 2:38 PM, Kyle Sluder wrote: > Given that Gordon's explicit use case involves one part of his app > setting up timers that point at objects in other parts of his app that > know nothing of the timers' existence, this sounds like a fragility > nightmare.

Re: Could somebody please fix NSTimer?

2013-01-14 Thread Quincey Morris
On Jan 14, 2013, at 12:38 , Kyle Sluder wrote: > Given that Gordon's explicit use case involves one part of his app > setting up timers that point at objects in other parts of his app that > know nothing of the timers' existence, this sounds like a fragility > nightmare.

Re: Could somebody please fix NSTimer?

2013-01-14 Thread William Sumner
that are compiled under different settings — most likely, a system >> framework compiled under MRR and an executable compiled under ARC. Indeed, >> the *same* NSTimer can be used from different places, which should >> presumably agree on how strongly the timer holds its target. >

Re: Could somebody please fix NSTimer?

2013-01-14 Thread Kyle Sluder
e involves one part of his app setting up timers that point at objects in other parts of his app that know nothing of the timers' existence, this sounds like a fragility nightmare. The NSTimer ship has sailed. --Kyle Sluder ___ Cocoa-dev mail

Re: Could somebody please fix NSTimer?

2013-01-14 Thread Charles Srstka
On Jan 14, 2013, at 1:23 PM, John McCall wrote: > On Jan 14, 2013, at 10:07 AM, David Duncan wrote: >> On Jan 12, 2013, at 10:49 AM, Gordon Apple wrote: >> >>> When compiled under ARC, NSTimer should have a weak, not strong, reference >>> to its target. &g

Re: Could somebody please fix NSTimer?

2013-01-14 Thread John McCall
On Jan 14, 2013, at 10:07 AM, David Duncan wrote: > On Jan 12, 2013, at 10:49 AM, Gordon Apple wrote: > >> When compiled under ARC, NSTimer should have a weak, not strong, reference >> to its target. > > If you want this, file a bug. Posting on the mailing list isn

Re: Could somebody please fix NSTimer?

2013-01-14 Thread David Duncan
On Jan 12, 2013, at 10:49 AM, Gordon Apple wrote: > When compiled under ARC, NSTimer should have a weak, not strong, reference to > its target. If you want this, file a bug. Posting on the mailing list isn't guaranteed to get your request anywhere close to the persons resp

Re: Could somebody please fix NSTimer?

2013-01-13 Thread Gordon Apple
Uh, that¹s where I¹m calling the wakeup methods for the other controllers in the nib. Then, I was suggesting calling ³shutDown² in windowWillClose. I guess I wasn¹t very specific. My window nibs generally have a variety of other controllers. I try my best to partition and encapsulate functional

Re: Could somebody please fix NSTimer?

2013-01-13 Thread Kyle Sluder
On Sun, Jan 13, 2013, at 03:44 PM, Gordon Apple wrote: > It may be ancient but, IMHO, it should be fixed, at least for ARC. It > is a > major source of unnecessary retain cycles and the fix is simple. I went > ahead and created a simple wrapper for NSTimer, as I originally > desc

Re: Could somebody please fix NSTimer?

2013-01-13 Thread Gordon Apple
It may be ancient but, IMHO, it should be fixed, at least for ARC. It is a major source of unnecessary retain cycles and the fix is simple. I went ahead and created a simple wrapper for NSTimer, as I originally described, and it works perfectly. I am going to file an enhancement request. You

Re: Could somebody please fix NSTimer?

2013-01-12 Thread Kyle Sluder
lement it yourself, or use one of the other existing implementations the framework provides for you: -viewDidMoveToSuperview, -windowWillClose, etc. > From the literature, it appears that NSTimer is the main offender in this > regard. NSTimer is something like twenty years old, but it i

Re: Could somebody please fix NSTimer?

2013-01-12 Thread Gordon Apple
And just how does one go about doing that? The only way I can see is to use an owner’s dealloc to call something like “wouldLikeToDealloc” on the owned object. From the literature, it appears that NSTimer is the main offender in this regard. I frequently use generic NSViewControllers and

Re: Could somebody please fix NSTimer?

2013-01-12 Thread Ian was here
2, 2013 10:49 AM Subject: Could somebody please fix NSTimer? When compiled under ARC, NSTimer should have a weak, not strong, reference to its target.  When the timer starts to fire, check the reference for nil and invalidate itself.  Come on guys, how hard is that?  You wouldn¹t even have to keep a

Re: Could somebody please fix NSTimer?

2013-01-12 Thread Gwynne Raskind
On Jan 12, 2013, at 2:05 PM, Kyle Sluder wrote: > On Jan 12, 2013, at 10:49 AM, Gordon Apple wrote: > >> When compiled under ARC, NSTimer should have a weak, not strong, reference >> to its target. When the timer starts to fire, check the reference for nil >> and inv

Re: Could somebody please fix NSTimer?

2013-01-12 Thread Kyle Sluder
On Jan 12, 2013, at 10:49 AM, Gordon Apple wrote: > When compiled under ARC, NSTimer should have a weak, not strong, reference > to its target. When the timer starts to fire, check the reference for nil > and invalidate itself. Come on guys, how hard is that? You wouldn¹t even >

Could somebody please fix NSTimer?

2013-01-12 Thread Gordon Apple
When compiled under ARC, NSTimer should have a weak, not strong, reference to its target. When the timer starts to fire, check the reference for nil and invalidate itself. Come on guys, how hard is that? You wouldn¹t even have to keep a reference to it, unless you want to invalidate it before

Re: Power Nap causing NSTimer to fire immediately

2012-08-04 Thread Charlie Dickman
I am not at all sure about the details but I think your app is receiving some sort of notification that power sleep is occurring in order to allow it to do what it needs to do in that situation. My guess is that all timers are caused to expire because when asleep they will not and then, when wak

Re: Power Nap causing NSTimer to fire immediately

2012-08-04 Thread Trygve Inda
> When our software is running and the Mac goes into Power Nap, our NSTimers > (which are fire-once and set to 3 hour periods) are firing immediately, so > the software does the timer work and installed a new fire-once timer for 3 > hours later. > > Except that one of course fires immediately and

Power Nap causing NSTimer to fire immediately

2012-08-04 Thread Trygve Inda
When our software is running and the Mac goes into Power Nap, our NSTimers (which are fire-once and set to 3 hour periods) are firing immediately, so the software does the timer work and installed a new fire-once timer for 3 hours later. Except that one of course fires immediately and it just keep

Re: Invalidate non-repeating NSTimer after fired?

2012-08-03 Thread Quincey Morris
7;invalidate' will prevent from "ever firing", according to the class documentation. Otherwise it's harmless. You don't care (and the documentation tells you not to care) when it's actually removed from the run loop. All you care about is that it won't fire. &

Re: Invalidate non-repeating NSTimer after fired?

2012-08-03 Thread Trygve Inda
> You must use the 2nd way. If you don't you could get a memory exception if the > timer has fired and, therefore, been invalidated. > > On Aug 3, 2012, at 4:19 PM, Trygve Inda wrote: My code looks like this: -(void)awakeFromNib { [self setUpd

Re: Invalidate non-repeating NSTimer after fired?

2012-08-03 Thread Lee Ann Rucker
ory exception if > the timer has fired and, therefore, been invalidated. > > On Aug 3, 2012, at 4:19 PM, Trygve Inda wrote: > >> NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval:60 target:self >> selector:@selector(wantsUpdate:) userInfo:nil repeats:NO] >> &g

Re: Invalidate non-repeating NSTimer after fired?

2012-08-03 Thread Charlie Dickman
You must use the 2nd way. If you don't you could get a memory exception if the timer has fired and, therefore, been invalidated. On Aug 3, 2012, at 4:19 PM, Trygve Inda wrote: > NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval:60 target:self > selector:@selector(

Invalidate non-repeating NSTimer after fired?

2012-08-03 Thread Trygve Inda
NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval:60 target:self selector:@selector(wantsUpdate:) userInfo:nil repeats:NO] Sometime after it fires (and occasionally before), I call if ( myTimer ) { [myTimer invalidate]; [myTimer release]; myTimer = nil; } Should I really be

NSTimer fireDate on invalidated timer not working according to docs

2012-08-03 Thread Trygve Inda
NSTime docs say: -- The date at which the receiver will fire. If the timer is no longer valid, this method returns the last date at which the timer fired. -- For an invalidated timer I am seeing a fireDate of: 2001-01-01 00:00:00 But I know it fired at 2012-08-03 19:39:12 Is this a known bug?

Re: NSTimer and touch events

2012-01-10 Thread Eric E. Dolecki
screenTimer = [NSTimer timerWithTimeInterval:2 target:self selector: > > @selector(turnOffScreen:) userInfo:nil repeats:NO]; > > You need scheduledTimerWithTimeInterval:... (as opposed to just > timerWithTimeInterval:...), in order for the timer to actually get posted. > The same

Re: NSTimer and touch events

2012-01-10 Thread Ben Kennedy
On 10 Jan 2012, at 12:03 pm, Eric E. Dolecki wrote: >screenTimer = [NSTimer timerWithTimeInterval:2 target:self selector: > @selector(turnOffScreen:) userInfo:nil repeats:NO]; You need scheduledTimerWithTimeInterval:... (as opposed to just timerWithTimeInterval:...), in order for the

NSTimer and touch events

2012-01-10 Thread Eric E. Dolecki
This is odd. Perhaps I need coffee. I have an app where I hide something by default (UIView). touchesBegan will make it visible. touchesMoved keeps visible. touchesEnded after 2 seconds. My method is never getting called. In my .h NSTimer *screenTimer; ... @property(nonatomic,retain) NSTimer

CVDisplayLink slows down execution of independent NSTimer

2011-05-21 Thread Travis Kirton
Hi, I am playing around with CVDisplayLink, I have it set up and running properly. I also have another method called update, which I am trying to run using a timer set to 60.0 frames per second. When I run the application without starting the CVDisplayLink, the update function runs very near to

Re: NSTimer firedate randomly changes

2010-11-18 Thread jonat...@mugginsoft.com
see no evidence of it either in the console or > the data. > Check out Mr Noodle with regard to sleepy timers: http://www.noodlesoft.com/blog/2010/07/01/playing-with-nstimer/ Regards Jonathan___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.

Re: Re: NSTimer firedate randomly changes

2010-11-18 Thread lorenzo7620
g Parker wrote: On Nov 17, 2010, at 2:12 PM, Kyle Sluder wrote: On Wed, Nov 17, 2010 at 2:07 PM, Dave DeLong davedel...@me.com> wrote: Here's what I got from that documentation: - An NSTimer is a run loop source. Ah, I think this is where my brain went all funny, because the NS

Re: NSTimer firedate randomly changes

2010-11-17 Thread Greg Parker
On Nov 17, 2010, at 2:12 PM, Kyle Sluder wrote: > On Wed, Nov 17, 2010 at 2:07 PM, Dave DeLong wrote: > Here's what I got from that documentation: > > - An NSTimer is a run loop source. > > Ah, I think this is where my brain went all funny, because the NSRunLoop &

Re: NSTimer firedate randomly changes

2010-11-17 Thread Kyle Sluder
On Wed, Nov 17, 2010 at 2:07 PM, Dave DeLong wrote: > Here's what I got from that documentation: > > - An NSTimer is a run loop source. > Ah, I think this is where my brain went all funny, because the NSRunLoop documentation mentions multiple times that "A timer is n

Re: NSTimer firedate randomly changes

2010-11-17 Thread Dave DeLong
Here's what I got from that documentation: - An NSTimer is a run loop source. - NSRunLoop monitors its sources for events, provided that the run loop is running in the mode that the source is scheduled in. - If the run loop is processing an event from a different source and a timer

Re: NSTimer firedate randomly changes

2010-11-17 Thread Wim Lewis
On 17 Nov 2010, at 1:54 PM, Kyle Sluder wrote: > Okay, that's two people who have corrected me on this now. What am I > misinterpreting about this documentation: > > http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/RunLoopManagement.html Whi

Re: NSTimer firedate randomly changes

2010-11-17 Thread Shawn Erickson
On Wed, Nov 17, 2010 at 1:54 PM, Kyle Sluder wrote: > On Wed, Nov 17, 2010 at 1:54 PM, Greg Parker wrote: > >> On Nov 17, 2010, at 1:35 PM, Kyle Sluder wrote: >> > That's not how timers work. They only fire if something wakes the runloop >> > after their time has expired. Usually this is an event

Re: NSTimer firedate randomly changes

2010-11-17 Thread Shawn Erickson
Pool alloc] init]; [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(timerFired:) userInfo:nil repeats:YES]; [[NSRunLoop curr

Re: NSTimer firedate randomly changes

2010-11-17 Thread Kyle Sluder
On Wed, Nov 17, 2010 at 1:54 PM, Greg Parker wrote: > On Nov 17, 2010, at 1:35 PM, Kyle Sluder wrote: > > That's not how timers work. They only fire if something wakes the runloop > > after their time has expired. Usually this is an event. > > Not true. A timer may fire some time after its fire d

Re: NSTimer firedate randomly changes

2010-11-17 Thread Greg Parker
On Nov 17, 2010, at 1:35 PM, Kyle Sluder wrote: > That's not how timers work. They only fire if something wakes the runloop > after their time has expired. Usually this is an event. Not true. A timer may fire some time after its fire date for any number of reasons, but "no event to wake the run l

Re: NSTimer firedate randomly changes

2010-11-17 Thread Kyle Sluder
t; there is no code that resets the full fetch timer; no need, it should run > every 4 hours. > That's not how timers work. They only fire if something wakes the runloop after their time has expired. Usually this is an event. Read the Overview section of the NSTimer reference: http:

NSTimer firedate randomly changes

2010-11-17 Thread Lorenzo Thurman
ize the mini timer: miniTimer = [[NSTimer scheduledTimerWithTimeInterval:[[self fetchInterval] floatValue] * 60.0 target:self selector:@selector(myMethod) userInfo:nil repeats:NO] retain]; This code gets called after every mini fetch to ensure the timer is set The full fetch timer is set

Re: [Q] Using NSInvocation vs. selector with NSTimer

2010-10-18 Thread JongAm Park
On 10/18/2010 9:45 AM, Keary Suska wrote: On Oct 18, 2010, at 9:00 AM, JongAm Park wrote: Is there any benefit in using it? My guess is that an NSInvocation instance is used repeatedly, but using the "selector" based method is not inconvenient for the most of cases. Is there any other benefi

  1   2   3   4   >