Sandboxed Mac apps can't add login items

Originator:kelan
Number:rdar://10157634 Date Originated:September 20, 2011
Status:duplicate of 10246244 Resolved:
Product:macOS + SDK Product Version:
Classification:bug Reproducible:always
 
Summary:
Sandboxed applications are not able to add login items.

Steps to Reproduce:
1) Make a sandboxed Mac application in Xcode 4, by going to the Target Summary tab, and enabling Entitlements and App Sandboxing.
2) Use LSRegisterURL() and SMLoginItemSetEnabled() to add a helper app as a login item.
    Note: This is the approach recommended by the documentation at http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLoginItems.html


Expected Results:
LSRegisterURL() should return noErr, SMLoginItemSetEnabled() should return True, and the helper app should lauch at login.


Actual Results:
LSRegisterURL() returns -10819 (which the documentation says is "kLSNotRegisteredErr, Not currently used."), SMLoginItemSetEnabled() returns False, and the helper app doesn't launch at login.


Regression:
With sandboxing turned off, this works correctly.


Notes:
I think is is a duplicate of (i.e. another vote for):
    * 9790207 - Sandboxed apps need ability to create login items
    * 9790252 - Sandboxing: Need Ability to include Monitor Process Apps
    * 10071628

There are some related discussions on the Developer Forums at:
    * Login Items: https://devforums.apple.com/message/473934
    * Bundled Helper/Monitor Apps: https://devforums.apple.com/message/496422

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!