I tried
LSSharedFileListRef globalLoginItems = LSSharedFileListCreate(NULL, kLSSharedFileListGlobalLoginItems, NULL);
if (globalLoginItems) {
LSSharedFileLi
NSString * appPath = [[NSBundle mainBundle] bundlePath];
// This will retrieve the path for the application
CFURLRef url = (CFURLRef)[NSURL fileURLWithPath:appPath];
LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListGlobalLoginItems, 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);
Doesn't work this code? I replaced kLSSharedFileListSessionLoginItems with kLSSharedFileListGlobalLoginItems