-(NSArray *) installedApps
{
BOOL isDir = NO;
NSDictionary *cacheDict;
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: @"User"]; // Then all the user (App Store /var/mobile/Applications) apps
}
NSLog(@"Installed Applications = %@",[user allKeys]);
return [user allKeys];
}
读取本机已安装app列表 只适用于越狱手机
最新推荐文章于 2021-03-23 10:30:20 发布