问题
I really need to disable App Nap in my OS X application in Swift but I've looked all over the web and can't find an answer. Any help would be appreciated.
回答1:
Try this:
let myQueue = OperationQueue()
let myActivity = ProcessInfo.processInfo.beginActivity(
options: ProcessInfo.ActivityOptions.userInitiated,
reason: "Batch processing files")
myQueue.addOperation(
{
// Perform batch processing of files here
ProcessInfo.processInfo.endActivity(myActivity)
}
)
Read more about App Nap on Apples reference site here.
来源:https://stackoverflow.com/questions/35679066/disable-app-nap