2011-01-06 93 views

回答

13

不,iOS應用程序有大約由於沙盒環境中的其他應用程序的/沒有信息。

+0

我找到了一個工作解決方案,不確定它會被蘋果接受!想法? – Unicorn 2011-01-28 11:06:12

+0

我認爲它不會) – 2011-01-28 12:11:20

+0

這裏是鏈接:http://www.iphonedevsdk.com/forum/iphone-sdk-development/22289-possible-retrieve-these-information.html – Unicorn 2011-01-28 12:20:24

2

不是來自設備。但是,從桌面上,您可以瀏覽iTunes資料庫。

1

有辦法做到這一點沒有越獄設備,並沒有讓你的應用程序被拒絕。
1.獲取當前正在運行的進程列表,請參閱this SO答案。您將需要從流程名稱轉換爲應用程序名稱。
2.檢查是否有任何應用程序使用UIApplicationDelegate canOpenURL註冊了唯一的URL方案。有幾個網站編目已知的網址方案,this是最好的。

如果某個應用程序當前未運行並且未註冊自定義url方案,則這些方法不會檢測到它。我有興趣聽到應用程序商店允許使用的方法比這更好。

4

是的,它可以讓所有安裝的應用程序

-(void) allInstalledApp 
{  
    NSDictionary *cacheDict; 

    NSDictionary *user; 

    static NSString *const cacheFileName = @"com.apple.mobile.installation.plist"; 

    NSString *relativeCachePath = [[@"Library" stringByAppendingPathComponent: @"Caches"] stringByAppendingPathComponent: cacheFileName]; 

    NSString *path = [[NSHomeDirectory() stringByAppendingPathComponent: @"../.."] stringByAppendingPathComponent: relativeCachePath]; 

    cacheDict = [NSDictionary dictionaryWithContentsOfFile: path]; 

    user = [cacheDict objectForKey: @"User"]; 

    NSDictionary *systemApp=[cacheDict objectForKey:@"System"]; 
} 

systemAppDictionary的列表包含所有系統相關的應用程序列表 和userDictionary包含其他應用程序的信息。

0

您可以通過檢查應用程序是否通過使用canOpenURL方法或通過檢查後臺進程,並將它們與應用程序,你有興趣的名稱匹配安裝或不能這樣做。

1

試試這個,它會即使使用非越獄設備:

​​
0

您可以使用運行時目標c獲取所有安裝的應用程序的列表。它會給你一個LSApplicationProxy對象的數組。

以下是打印設備中安裝的所有應用程序的名稱的代碼片段。

Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace"); 
NSObject* workspace = [LSApplicationWorkspace_class performSelector:NSSelectorFromString(@"defaultWorkspace")]; 
NSMutableArray *array = [workspace performSelector:NSSelectorFromString(@"allApplications")]; 

NSMutableArray *mutableArray = [[NSMutableArray alloc] init]; 
for (id lsApplicationProxy in array) { 
    if(nil != [lsApplicationProxy performSelector:NSSelectorFromString(@"itemName")]){ 
     [mutableArray addObject:[lsApplicationProxy performSelector:NSSelectorFromString(@"itemName")]]; 
    } 
} 
NSLog(@"********* Applications List ************* : \n %@",mutableArray); 

不要忘記包括<objc/runtime.h>