4

This is similar to this issue: Error in Sandboxed App, When loading Helper (LoginItems), code signing issue

The error that I'm getting is the same, but installing the app in /Applications doesn't fix the problem because since SMLoginItemSetEnabled only allows you to set an app bundle id and not the actual app location, it always ends up trying to load some other copy of the helper app that is not in /Applications. Theoretically I could delete all copies of the App on my computer and that should fix the problem, but I cannot prevent users from keeping multiple copies of my app on their computer, which would break the launch at login feature.

Is there a way around this?

Community
  • 1
  • 1
  • https://stackoverflow.com/questions/27995970/smloginitemsetenabled-sometimes-silently-fails-to-launch-sandboxed-ui-helper/ – pkamb Nov 01 '18 at 23:37

1 Answers1

1

Bump the version number of the instance of the login item that you want to be launched. If it's the highest version number, the system should prefer it to existing lower versions of the login item.

If multiple applications (for example, several applications from the same company) contain a helper application with the same bundle identifier, only the one with the greatest bundle version number is launched. Any of the applications that contain a copy of the helper application can enable and disable it.

https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLoginItems.html#//apple_ref/doc/uid/10000172i-SW5-SW1

pkamb
  • 33,281
  • 23
  • 160
  • 191
  • You're assuming that the user has old versions laying around. What if they have duplicates of the same version? – Nathan Peterson Mar 18 '19 at 00:57
  • @NathanPeterson I'm speaking mainly of strategies to use when developing the app, which will often lead to you having multiple copies and versions. – pkamb Mar 19 '19 at 16:53