Disable App Nap in MacOS 10.9 (Mavericks) application

后端 未结 2 1085
孤城傲影
孤城傲影 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!

提交回复
热议问题