2

私はこの質問を見ました:

iOSで現在のアプリケーションアイコンを取得する方法

これで、プロセス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];
}
4

1 に答える 1

1

NSBundle オブジェクトは、ジェイルブレイク iOS、非ジェイルブレイク iOS デバイスでのみ取得できます。コード: NSBundle* bundle = [NSBundle bundleWithPath:apppath]; get バンドルは nil です。そのため、アイコンを取得できません。

于 2012-12-24T09:14:11.040 に答える