简体   繁体   English

如何从iOS系统上的进程pid获取其他应用程序图标?

[英]How to get other application icon from process pid on iOS system?

I have seen this question: 我已经看到了这个问题:

How to get the current application icon in ios 如何在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. 现在我可以从进程pid获取应用程序路径,然后根据上面的问题,使用代码打击,我无法获得应用程序图标。

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];
}

You can get the NSBundle object only in a jailbreak iOS, in a non-jailbreak iOS device, the code: NSBundle* bundle = [NSBundle bundleWithPath:apppath]; 您只能在未越狱的iOS设备上(非越狱的iOS设备)获取NSBundle对象,代码如下:NSBundle * bundle = [NSBundle bundleWithPath:apppath]; get the bundle is nil. 得到捆绑是零。 So, you can not get the icon. 因此,您无法获取该图标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM