Not quite sure what "correct" means there, but I use the AppleScript approach 
in a couple of my apps and it works without issue. Doesn't require elevated privileges, 
and it's tied to a checkbox user preference which gets saved in StandardUserDefaults.

If your app is sandboxed you'll need to call it via NSUserAppleScriptTask, see:

https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSUserAppleScriptTask_Class/index.html#//apple_ref/doc/uid/TP40012267-CH1-SW2

Best

Phil
@sqwarq
http://sqwarq.com

On Apr 20, 2016, at 04:48 PM, dangerwillrobinsondan...@gmail.com wrote:

I believe the correct answer is LaunchAgent plist, XPC helper LaunchAgent or instruct users to manually add it in system preferences or provide a script they can manually run once.

Sent from my iPhone

On Apr 20, 2016, at 6:01 PM, sqwarqDev <sqwarq...@icloud.com> wrote:

If you’re willing (or able: beware sandboxing issues) to call either osascript 
or NSAppleScript, you can do this via a bit of AppleScript magic:


tell application "Finder" to set aPath to POSIX path of (application file id 
”com.yourBundleID.yourApp" as string)

tell application "System Events”
make new login item at end of login items with properties {path:aPath, hidden:false, 
kind:\"Application\", name:”Your App Name”}
end tell



Best

Phil
@sqwarq
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/dangerwillrobinsondanger%40gmail.com

This email sent to dangerwillrobinsondan...@gmail.com
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to