2

I have seen this question:

How to get the current application icon in ios

Now i could get application path from process pid, then according the question above,with the code blow,i could not get the application icon.

NSBundle* bundle = [NSBundle bundleWithPath:apppath];
NSArray *infostmp = [[bundle infoDictionary] objectForKey:@"CFBundleIconFiles"];
if(infostmp){
     NSString* iconPath = [[NSString alloc] initWithString:[infostmp objectAtIndex:0]];
     UIImage*  icon =[UIImage imageWithContentsOfFile:iconPath];
}
Community
  • 1
  • 1
timestee
  • 1,086
  • 12
  • 36

1 Answers1

1

You can get the NSBundle object only in a jailbreak iOS, in a non-jailbreak iOS device, the code: NSBundle* bundle = [NSBundle bundleWithPath:apppath]; get the bundle is nil. So, you can not get the icon.

Magic fish
  • 78
  • 11