2011-03-28 58 views
1

有沒有一種方法(如果是這樣,如何)獲取給定應用程序包ID的圖標。假設我有一個UIImage,我想包含與facebook應用程序相關的圖標(如果這些圖標安裝在我的iOS設備上)。捆綁圖標給定包ID

+2

這將涉及到的代碼,將有機會獲得您的沙箱之外,更可能會在應用程序商店審查程序被阻止。您可能需要考慮嘗試從第三方來源(如http://appshopper.com/)獲取圖標,並獲得他們的許可。 – Joe 2011-03-28 21:41:25

回答

0

從用戶的應用程序訪問數據是在生產中的應用是不可能的,因爲蘋果公司提供了iOS應用程序編程指南中的明確和徹底的定義:

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

雖然理論上是可能的在實踐中,它肯定會被禁止訪問iOS App Store,因爲它會直接違背上述準則。

4

您可以使用私有API。這對於內部應用程序可能很有用。

@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