1

I'm having trouble with a Mac App Store submission. I'm using the method below to add my App to the login items if the user toggles the checkbox in the preferences.

-(void) addAppAsLoginItem{
    NSString * appPath = [[NSBundle mainBundle] bundlePath];

    CFURLRef url = (CFURLRef)[NSURL fileURLWithPath:appPath]; 

    LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
    if (loginItems) {
        //Insert an item to the list.
        LSSharedFileListItemRef item = LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemLast, NULL, NULL, url, NULL, NULL);
        if (item){
            CFRelease(item);
        }
    }   

    CFRelease(loginItems);

}

I‘ve already submitted many updates successfully without any problems, but now my App got rejected, rejected because I'm accessing the file system:

2.30

The application accesses the following location:

'~/Library/Preferences/loginwindow.plist'

This file is used to set an application to launch at login. It should not be modified until the user has enabled such an option within the application. This option should not be enabled by default; the user must take the action of enabling it.

So now I'm confused, because this method was there since the first release and was never a problem. The file is only read or modified when the user toggles the corresponding checkbox in the preferences.

So how should I add my App to the startup login items without getting rejected again?

Kara
  • 6,115
  • 16
  • 50
  • 57
tamasgal
  • 24,826
  • 18
  • 96
  • 135
  • Is this checkbox enabled by default? – spudwaffle Jan 13 '12 at 04:07
  • To submit to the app store you must be a developer. Go to the dev forums and search on this topic - there are recent posts on this you need to read. – CRD Jan 13 '12 at 10:00
  • I found some topics on the dev forums, but no solution. My app accesses the ~/Library/Preferences/loginwindow.plist only when the user interacts with the corresponding checkbox (and is not enabled by default), so there is no "hidden access" to that file. As of http://developer.apple.com/library/mac/#releasenotes/General/SubmittingToMacAppStore/_index.html#//apple_ref/doc/uid/TP40010572 I'm not able to write loginwindow anyhow, but how do I set up a "start on login" option if I don't have access to the required plist?! – tamasgal Jan 13 '12 at 10:57

3 Answers3

1

Look at SMLoginItemSetEnabled and the docs here.

As you're an apple developer you should also look again at the dev forums for discussions on this topic - they are there.

HTH

CRD
  • 52,522
  • 5
  • 70
  • 86
  • I looked at the dev forums and also read the document about the helper application, but I don't want add one to my project, since there are other apps which have the option to start them at login without having a helper app. – tamasgal Jan 13 '12 at 19:55
0

As I read it: You may not enable it as a login item by default - without asking the user.

tcurdt
  • 14,518
  • 10
  • 57
  • 72
  • "The file is only read or modified when the user toggles the corresponding checkbox in the preferences." – tamasgal Jan 13 '12 at 10:44
  • Easy on the -1. There are just two options. Either you had the "start on login" enabled by default or the reviewer messed up. Maybe he wanted to push you to use the new approach which is not a requirement *yet*. If I was you I would just make the switch an be done with it. You might want to have a look here https://github.com/tcurdt/TCLoginItemHelper – tcurdt Jan 13 '12 at 20:27
  • Well you're right, but I mentioned in my question that it is only affected if the user interacts. But anyway, sorry because the -1, it's really not OK, especially with your addition -> TCLoginItemHelper! Please write it in your answer, so I can toggle +1 ;-) – tamasgal Jan 13 '12 at 22:39
0

I submitted the app again and it got approved within 5 hours. I didn't receive any response from the App Store team to my support request though…

tamasgal
  • 24,826
  • 18
  • 96
  • 135