Hi,
I write bellow code to get apps which are installed in iPhone device.But it works on iOS5.1.1 not works on iOS6.1.3.
Code is:
Please help me out ,how to get app name in iOS6.1.3
Thanks &Regards,
Manga
I write bellow code to get apps which are installed in iPhone device.But it works on iOS5.1.1 not works on iOS6.1.3.
Code is:
Code:
BOOL isDir= NO;
NSMutableArray *applicationsArray=[[NSMutableArray alloc]init];
NSDictionary *user, *system;
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)
{
NSDictionary *cacheDict = [NSDictionary dictionaryWithContentsOfFile: path];
user = [cacheDict objectForKey: @"User"];
system=[cacheDict objectForKey:@"System"];
}
NSArray *arr1=[[NSArray alloc] initWithArray:[system allKeys]];
for (int i=0; i<[[system allKeys] count]; i++) {
[applicationsArray addObject:[[system valueForKey:[arr1 objectAtIndex:i]] valueForKey:@"Path"]];
}
NSArray *arr2=[[NSArray alloc] initWithArray:[user allKeys]];
for (int i=0; i<[[system allKeys] count]; i++) {
[applicationsArray addObject:[[user valueForKey:[arr2 objectAtIndex:i]] valueForKey:@"Path"]];
}
for (int i=0; i<applicationsArray.count; i++)
{
NSArray *arr3=[[applicationsArray objectAtIndex:i] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]];
NSArray *arr4=[[arr3 lastObject] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"."]];
NSMutableDictionary *dict=[[NSMutableDictionary alloc]init];
[dict setValue:[arr4 objectAtIndex:0] forKey:@"appName"];
[dict setValue:@"1" forKey:@"State"];
[self.tableViewArray addObject:dict];
dict=nil;
arr1=nil;
arr2=nil;
}
Please help me out ,how to get app name in iOS6.1.3
Thanks &Regards,
Manga