Search code examples
macosassertionsosx-mountain-lion

OS X Mountain Lion power assertions


I'm trying to find some sample code or examples or good documentation on how to use power assertions on OS X programatically. Mountain lion seems to kill the network access on system sleep, so Apple recommends to use power assertions to keep the system awake and to preserve network access available. Appropriate command to modify power assertions is pmset, however I did not find any example on how to use it. As a sidenote, Snow Leo and Lion don't seem to be having this problem, so I'm guessing this must be some power optimization setting introduced with Mountain Lion. Any code samples/example/documentation on how to set a power assertion programatically for an application would be gladly welcomed.


Solution

  • Answering my own question :) . I've found a way to achieve this after doing some reading. IOKit framework seems to provide support for registering power assertions. More details on this address: IOPMLib library reference