Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 如何获取mac上所有启动/登录应用程序的列表?_Objective C_Cocoa - Fatal编程技术网

Objective c 如何获取mac上所有启动/登录应用程序的列表?

Objective c 如何获取mac上所有启动/登录应用程序的列表?,objective-c,cocoa,Objective C,Cocoa,我想用objective c获得启动Mac时启动的所有应用程序的列表/数组 提前谢谢 以下是从启动时获取所有应用程序列表的代码 // Get the LoginItems list. LSSharedFileListRef loginItemsRef = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL); if (loginItemsRef == nil) return nil;

我想用objective c获得启动Mac时启动的所有应用程序的列表/数组


提前谢谢

以下是从启动时获取所有应用程序列表的代码

     // Get the LoginItems list.
    LSSharedFileListRef loginItemsRef = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
    if (loginItemsRef == nil) return nil;
    // Iterate over the LoginItems.
    NSArray *loginItems = (__bridge NSArray *)LSSharedFileListCopySnapshot(loginItemsRef, nil);

   for (id item in loginItems) {
   // do what you want
   }