Disable App Nap in MacOS 10.9 (Mavericks) application

后端 未结 2 1084
孤城傲影
孤城傲影 2020-12-03 03:27

I am writing an application that receives OSC messages. However, due to 10.9\'s App-Nap-technology the application stops reacting on these messages after leaving foreground.

相关标签:
2条回答
  • 2020-12-03 03:46

    the activity need to be stored in a property. So I added this in the header-file:

    @property (strong) id activity;
    

    and then used this implementation.

    if ([[NSProcessInfo processInfo] respondsToSelector:@selector(beginActivityWithOptions:reason:)]) {
        self.activity = [[NSProcessInfo processInfo] beginActivityWithOptions:0x00FFFFFF reason:@"receiving OSC messages"];
    }
    

    Thanks to all contributors!

    0 讨论(0)
  • 2020-12-03 03:55

    From your description of the problem it sounds like you might want to take a look at WWDC 2013 704 and review the section (near the end) on background continuous work. A look at the manual for the setpriority command may also be helpful. I haven't had a need to disable app nap but I think manual change of the process priority is a good approach.

    2013 WWDC Video 205 (near the middle) describes some interesting aspects of app nap that can affect the outcome of whether the app is throttled. Video 209 from WWDC 2013 presents the following screenshots on Occlusion (the point where app nap engages) may be useful.

    App Occlusion

    Window Occlusion

    Occlusion Example Hope this helps.

    0 讨论(0)
提交回复
热议问题