I have a problem with the apple sandbox and the functionality of my app. The app should put my mac into sleep, or shutdown or restart it. I am using "com.apple.security.temporary-exception.apple-events" as the entitlement for sandbox with the value "com.apple.finder". I have imported ScriptingBridge and generated a Finder.h file which i have also included in my project like its proposed in https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/UsingScriptingBridge/UsingScriptingBridge.html#//apple_ref/doc/uid/TP40006104-CH4-SW12
Then i tried to use the provided methods from Finder.h like shutDown, restart or sleep but they just don't work.
FinderApplication *theFinder = [SBApplication applicationWithBundleIdentifier:@"com.apple.finder"];
[theFinder shutDown];
Can anyone tell me how i can implement these functionalities in a sandboxed app?
Many Thanks!
Checkout https://developer.apple.com/library/mac/qa/qa1134/_index.html
This guide provides the exact code you are looking for. I have tried this and it works perfectly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With