I am trying to use the IOKit power management functions for keeping the screen on. However there is something wrong as I am getting linker errors. What I have done is:
In Build Settings -> Search Paths -> Framework Search Paths -> I added link for the framework path which is 'Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks'
In Build Phases under 'Link Binary with Libraries' I clicked the + and under AppleSDK there is the IOKit.framework so I've added that.
Under Copy Files there is a link to the IOKit.frameworks which lives in 'Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/System/Library/Frameworks'
I assume one or more of these is wrong as I keep getting a failed build.
Does my 'Framework search Path' seem correct?
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/System/Library/Frameworks/IOKit.framework
I think it is nearly working as it compiles fine with no linker errors unless I add this line then it errors:
IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR("My app is running"), &preventSleepAssertionID);
I solved it. It turned out I was missing the Core Framework. Once I'd added that it worked.