如何获取iPhone中安装的应用程序列表名称

时间:2013-01-16 09:48:54

标签: iphone ios objective-c xcode ipad

  

可能重复:
  Get list of all installed apps

我正在寻找应用程序控制系统工具,我希望在其中列出所有已安装的应用程序名称,并允许用户更改其状态,即用户可以隐藏跳板中的那些。是的,如果可以,那怎么样?请帮我解决?

1 个答案:

答案 0 :(得分:2)

试试这个

-(NSArray *) installedApps
{
    BOOL isDir enter code here= NO;
    NSDictionary *cacheDienter code herect;
    NSDictionary *user;
    static NSString *const cacheFileName = @"com.apple.mobile.installation.plist";
    NSString *relativeCachePath = [[@"Library" stringByAppendingPathComponent: @"Caches"] stringByAppendingPathComponent: cacheFileName];
    NSString *path = [[NSHomeDirectory() stringByAppendingPathComponent: @"../.."] stringByAppendingPathComponent: relativeCachePath];
    if ([[NSFileManager defaultManager] fileExistsAtPath: path isDirectory: &isDir] && !isDir) // Ensure that file exists
    {
        cacheDict    = [NSDictionary dictionaryWithContentsOfFile: path];
        user = [cacheDict objectForKey: @"System"]; // Then all the user (App Store /var/mobile/Applications) apps
    }



    //NSLog(@"Installed Applications = %@",[user allKeys]); 
    //return [user allKeys];
    return nil;
}

这将为您提供已安装的应用程序阵列。

此链接也有助于您Link