Retrive Apps name in iphone device

Joined
Oct 1, 2012
Messages
27
Reaction score
0
Points
1
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:

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
 

Raz0rEdge

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
15,762
Reaction score
2,100
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
How does this fail in iOS 6?
 
Joined
Aug 13, 2011
Messages
200
Reaction score
7
Points
18
Location
West Sussex
Sandboxing was introduced from iOS6 and onwards, so you're code won't work for that reason in iOS6.
You can only access information and data from you're own Apps sandbox only, as as fare as I know there's
no way to do what you want in the iOS6 system.

But I'll look into it a bit more, and report back if I can work out a way to do it.

Regards Mark
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top