Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8250839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:02:15+00:00 2026-06-08T00:02:15+00:00

I need to start my app at system launch, but the problem is: it

  • 0

I need to start my app at system launch, but the problem is: it is already in App Store, so I must follow some rules like using sandboxing. This leads to fail of desired functions like LSSharedFileListInsertItemURL and SMLoginItemSetEnabled. How should I act in this case?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T00:02:17+00:00Added an answer on June 8, 2026 at 12:02 am

    I recently went through this same process, unfortunately with sandboxing it’s not nearly as easy to do as it used to be. I made a test application with very detailed instructions that is now on Github

    Notes

    This demo application and your application will only work if they are deployed preferably in the /Applications/MyGreat.app and will not work reliably from the Xcode debug folder.

    Project settings

    These are the settings of my project that worked perfectly with this implementation.

    1. Create a new project with ARC enabled
    2. Sandbox both your main application and helper application (if you haven’t created a helper yet we will get to it shortly) I also enabled code signing
    3. Since this was just a test application I had no active entitlements for either the main application or the helper
    4. If you haven’t already, create a helper app. Go to your project settings and click “Add Target” choose a Cocoa Application. Name it something such as MyAwesomeProjectHelper also with ARC enabled. (I left its “App Store Category” blank)
    5. Now select the Target of your main application. Go to Build Phases -> Add Build Phase -> Add Copy Files.
    6. Change the Destination to Wrapper. Make the Subpath Contents/Library/LoginItems leave Copy only when installing unchecked. Drag your helper application from Products on the left into the tableview.

    Main Application code setup

    1. Import ServiceManagement.framework into your main application(not your helper) and include #import <ServiceManagement/ServiceManagement.h> in your .h file
    2. Grab StartAtLoginController from Github. This is an easy to use class by Alex Zielenski to deal with the complications of adding, removing and querying login items. Import StartAtLoginController.h into your h file.
    3. Create whatever interface you want to for controlling this setting. If your application automatically enables this it will be denied from the Mac App Store(per guideline #2.26)
    4. Implement a method such as - (IBAction)checkChanged:(id)sender I made a simple checkbox tied to the StandardUserDefaults. (If you chose to do something else your implementation for this may vary.) I also bound the checkbox to IBOutlet NSButton *loginCheck; in order to determine it’s state. This could also be done through [[NSUserDefaults standardUserDefaults] boolForKey:YourKey]
    5. Implement code similar to this in your .m file.

      StartAtLoginController *loginController = [[StartAtLoginController alloc] init];
      [loginController setBundle:[NSBundle bundleWithPath:[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Contents/Library/LoginItems/HelperApp.app"]]]; 
      // Change "HelperApp.app" to the name of your helper
      
      if ([loginCheck state]) {
          if (![loginController startAtLogin]) {
              [loginController setStartAtLogin: YES];
          }
      } else {
          if ([loginController startAtLogin]) {
              [loginController setStartAtLogin:NO];
          }
      }
      
    6. That’s it. As you can see in this project there are some other methods you may want to use such as:

      if ([loginController startAtLogin]) {
          NSLog(@"Error");
      }
      

      For checking after you enable or disable the setting to make sure it worked correctly. Or this:

      BOOL startsAtLogin = [loginController startAtLogin];
      if (startsAtLogin) {
          // Do stuff
      }
      

      To do something if the login helper is enabled.

    Helper Application code setup

    Make sure to test this code vigorously with your implementation.

    1. Make your helper application a UIElement by navigating to HelperApp.plist located in the Supporting Files group by default. Add a line at the bottom with the Key Application is agent (UIElement) and YES as the Value (this will suppress the application from flashing a dock icon each time the user enables launch at login) I also deleted everything except for the App Delegate in interface builder
    2. Erase the default method - (void)applicationDidFinishLaunching:(NSNotification *)aNotification and replace it with - (void)applicationWillFinishLaunching:(NSNotification *)aNotification
    3. Within this method implement code similar to this.

      NSString *appPath = [[[[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByDeletingLastPathComponent] stringByDeletingLastPathComponent] stringByDeletingLastPathComponent];
      // This string takes you from MyGreat.App/Contents/Library/LoginItems/MyHelper.app to MyGreat.App This is an obnoxious but dynamic way to do this since that specific Subpath is required
      NSString *binaryPath = [[NSBundle bundleWithPath:appPath] executablePath]; // This gets the binary executable within your main application
      [[NSWorkspace sharedWorkspace] launchApplication:binaryPath];
      [NSApp terminate:nil];
      

      This code finds your main application, determines it’s binary executable(required to launch the application within the sandbox) opens your application, then quits

    4. That’s it.

    Deploy

    The last thing you should do when deploying your application for yourself or to the Mac App store is remove your Helper app from the Archived items. Do this by navigating to the Target of your HelperApp -> Build Settings -> Skip Install and set Yes for Release. Apple provides more information at (http://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/000-About_Xcode/about.html)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've never used xml builder in my rails 3 app, but need to start.
One app in my system can handle URI like weibo://abc, I want to start
I need to start a copy of a Rails app from within Java. I
In my app, I need to set a variable for a start time to
I need to start a Visual Basic script file by using WMI in a
I need to start a program every time the user logs in, but I
I need to read a text file when I start my program. I'm using
I have a little idea for an App, but in order to start I
I need to change Activity to ListActivity. But I can't start my project... do
I need to start building an Android app that uses the JUCE libraries. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.