Nick
Nick

Reputation: 2646

bundle icon for given bundle id

Is there a way (and if so, how) to fetch the icon for given app bundle id. Say I have a UIImage which I would like to contain the icon associated with the facebook app (if such is installed on my iOS device).

Upvotes: 1

Views: 1130

Answers (2)

Eltiren
Eltiren

Reputation: 51

You can use private APIs. This maybe useful for in-house applications.

@interface UIImage (UIApplicationIconPrivate)
/*
 @param format
    0 - 29x29
    1 - 40x40
    2 - 62x62
    3 - 42x42
    4 - 37x48
    5 - 37x48
    6 - 82x82
    7 - 62x62
    8 - 20x20
    9 - 37x48
    10 - 37x48
    11 - 122x122
    12 - 58x58
 */
+ (UIImage *)_applicationIconImageForBundleIdentifier:(NSString *)bundleIdentifier format:(int)format;
@end

Upvotes: 5

element119
element119

Reputation: 7625

Accessing data from a user's applications is impossible in production applications, as explicitly and thoroughly defined in the iOS Application Programming Guide provided by Apple:

For security reasons, iOS restricts each application (including its preferences and data) to a unique location in the file system. This restriction is part of the security feature known as the application’s sandbox. The sandbox is a set of fine-grained controls limiting an application’s access to files, preferences, network resources, hardware, and so on. Each application has access to the contents of its own sandbox but cannot access other applications’ sandbox.

(Link)

Although theoretically possible in practice, it would most certainly be disallowed from access to the iOS App Store as it would directly contradict the above guidelines.

Upvotes: 0

Related Questions