Sandboxing in pyobjc : Login at startup

171 Views Asked by At

I have a pyobjc app which I am packaging with py2app. I also have a checkbox using which the user can choose to add the app to start when the system is restarted. I was doing this with LaunchServices, however, this does not work when the app is sandboxed. I am trying to achieve this behaviour using ServiceManagement. http://blog.timschroeder.net/2012/07/03/the-launch-at-login-sandbox-project/ . Since I am using pyobjc, I don't use xcode.

I have manually created the helper app, signed it and placed it in Contents\Library\LoginItems. When I call, SMLoginItemSetEnabled('com.*****.HelperApp', True), I see that the helper app is started. The documentation says that the helper app is now called whenever the user logs in. However, this doesn't seem to happen. Is there any additional step that is required? Is the helper app supposed to start everytime the system is restarted or when a user logs out and logs back in?

However, I see a couple of errors in the console:

14/10/14 2:47:40.155 pm lsboxd[312]: Not allowing process 611 to launch "/Users/pradeep/desktop_documents/packaging/osx/build/dist/app_name.app/Contents/Library/LoginItems/Login_Helper.app" because the security assessment verdict was denied.
14/10/14 2:47:40.155 pm lsboxd[312]: Not allowing process 611 to register app "/Users/pradeep/desktop_documents/packaging/osx/build/dist/app_name.app/Contents/Library/LoginItems/Login_Helper.app" for launch.

When I try to restart the machine, I notice that the helper app is not restarting. Just before shutting down, The Helper app is getting killed.

0

There are 0 best solutions below