Re: How to make an app launch on login?

2016-04-20 Thread Jens Alfke
FYI, I just filed a bug report complaining about the lack of a reasonable native API for this. rdar://25834170 . —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact

Re: How to make an app launch on login?

2016-04-20 Thread Alex Zavatone
I use a super useful and nice little tool for iOS called SimulatorManager that has the option to make it an item that is launched at startup. It probably contains the code you need. It is here: https://github.com/tue-savvy/SimulatorManager Hope this helps. Alex Zavatone On Apr 19, 2016, at

Re: How to make an app launch on login?

2016-04-20 Thread sqwarqDev
| On Apr 20, 2016, at 05:00 PM, sqwarqDev wrote: | If your app is sandboxed you'll need to call it via NSUserAppleScriptTask Correction: NSUserScriptTask

Re: How to make an app launch on login?

2016-04-20 Thread sqwarqDev
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

Re: How to make an app launch on login?

2016-04-20 Thread dangerwillrobinsondanger
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 wrote: > > If you’re

Re: How to make an app launch on login?

2016-04-20 Thread sqwarqDev
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” 

Fwd: How to make an app launch on login?

2016-04-20 Thread Jeff Szuhay
As Jens suggested in another thread, launchd is likely too low-level. Finally, there is Tim Schroeder’s “Launch At Login Project” which enables a sandboxed app to launch itself.

Re: How to make an app launch on login?

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 2:43 PM, Jeff Szuhay wrote: > > The preferred way seems to be through the use of launchd I don’t think so. I’ve worked with launchd before — it provides very low-level functionality for starting background processes, and there’s no visible UI for

Re: How to make an app launch on login?

2016-04-19 Thread Jeff Szuhay
Again, I jumped the gun. The preferred way seems to be through the use of launchd

Re: How to make an app launch on login?

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 2:35 PM, Jeff Szuhay wrote: > > I spoke too soon; yes, all of this is marked as “available but deprecated on > 10.11”. Yeah, interesting that Apple added LSSharedFileListItemCopyResolveURL in 10.10 and then deprecated it in 10.11. Oops! I guess I’ll

Re: How to make an app launch on login?

2016-04-19 Thread Jeff Szuhay
I spoke too soon; yes, all of this is marked as “available but deprecated on 10.11”. I would hope that Apple would provide sample code to show the preferred new way to do this. > On Apr 19, 2016, at 2:29 PM, Jeff Szuhay wrote: > > There was some discussion of this on stack

Re: How to make an app launch on login?

2016-04-19 Thread Jeff Szuhay
There was some discussion of this on stack overflow but one of the APIs there is deprecated: LSSharedFileListItemResolve. It’s 3rd parameter takes a pointer to a CFURLRef and that is now deprecated. Instead, use LSSharedFileListItemCopyResolveURL; basically the return value from this is what

How to make an app launch on login?

2016-04-19 Thread Jens Alfke
One of my companies’ apps has a “Launch at login” pref, which no longer works in OS X 10.11. I’m not surprised, since the existing code implements this by writing into loginwindow’s user defaults :-p I’m trying to find the currently supported API for this. The “Adding Login Items” page says: >