获取iPhone已经安装程序列表

首先,必须确定iPhone是越狱的,并且你的下面代码运行的目录为/Applications/.

NSFileManager
* fileManager = [NSFileManager defaultManager];
NSMutableArray
* applist = [NSMutableArray arrayWithCapacity:10];
for (NSString *path in [fileManager directoryContentsAtPath:@"/var/mobile/Applications"]) {
for (NSString *subpath in [fileManager directoryContentsAtPath:
[NSString stringWithFormat:
@"/var/mobile/Applications/%@", path]]) {
if ([subpath hasSuffix:@".app"])
{
NSString
* infoplist = [NSString stringWithFormat:@"/var/mobile/Applications/%@/%@/Info.plist", path, subpath];
NSLog(
@"sdfsadfa0%@",infoplist);
NSDictionary
* dict = [NSDictionary dictionaryWithContentsOfFile:infoplist];
NSLog(
@"sdfsadfa1%@",dict);

[applist addObject:[dict objectForKey:
@"CFBundleDisplayName"]];
}
}

  

你可能感兴趣的:(获取iPhone已经安装程序列表)