Load app icon from xcassets

2 Solutions Collect From Internet About “Load app icon from xcassets”

By inspecting the bundle I found that the icon images were renamed as:


And so on.

Thus, using [UIImage imageNamed:@"AppIcon76x76"] or similar works.

Is this documented somewhere?

I recommend retrieving the icon URL by inspecting the Info.plist since there’s no guarantee how the Icon files are named:

NSDictionary *infoPlist = [[NSBundle mainBundle] infoDictionary];
NSString *icon = [[infoPlist valueForKeyPath:@"CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles"] lastObject];
imageView.image = [UIImage imageNamed:icon]; 

In this case we’re fetching the last image URL of the CFBundleIconFiles array. It has the largest resolution. Change this if you need a smaller resolution.