开发者

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 woul开发者_JAVA技巧d like to contain the icon associated with the facebook app (if such is installed on my iOS device).


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜