Page 2 of 2
Re: OS X 10.9 & App Nap
Posted: Thu Aug 07, 2014 1:18 am
by J. Baker
I tried that a when Danilo posted it but it didn't work for me for some reason. Glad it worked for you guys.

Re: OS X 10.9 & App Nap
Posted: Thu Aug 07, 2014 7:57 am
by Danilo
@J.Baker:
Could it have something to do with the flags you use? ( #NSActivityBackground or #NSActivityUserInitiated or ... )
Re: OS X 10.9 & App Nap
Posted: Thu Aug 07, 2014 12:55 pm
by J. Baker
Danilo wrote:@J.Baker:
Could it have something to do with the flags you use? ( #NSActivityBackground or #NSActivityUserInitiated or ... )
If I remember correctly, I tried all possible flags. I'm not sure why it didn't work for me but I can try it again sometime soon.
Re: OS X 10.9 & App Nap
Posted: Thu Aug 07, 2014 8:20 pm
by spacebuddy
J. Baker,
Yes, use those two variables. You need to call this in your thread or a timer and it should work
I tested in Maverick and Yosemite and it works.
I think App Nap kicks in when the CPU goes to 0 for a little bit. What you can try is setup a timer (1000 ms) which will ramp the CPU
up to like 0.3 which should stop App Nap. I have not tested this, but it should work.
Nevermind, I just tried that and it does not work.
Here is the code I use to stop App Nap.
NSProcessInfo = CocoaMessage(0,0,"NSProcessInfo processInfo")
If NSProcessInfo
Value=#NSActivityUserInitiated ! #NSActivityLatencyCritical
EndIf
CocoaMessage(0,NSProcessInfo,"beginActivityWithOptions:@",@Value,"reason:$",@"block")
Re: OS X 10.9 & App Nap
Posted: Thu Aug 07, 2014 11:58 pm
by J. Baker
Thanks and will try again. My app was using roughly 7-10% cpu when I first tried it but app nap still kicked in. Mavericks has been updated since then though, so maybe it will work now.