14
A
回答
13
不,iOS應用程序有大約由於沙盒環境中的其他應用程序的/沒有信息。
2
不是來自設備。但是,從桌面上,您可以瀏覽iTunes資料庫。
1
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"];
}
systemApp
Dictionary
的列表包含所有系統相關的應用程序列表 和user
Dictionary
包含其他應用程序的信息。
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>
。
我找到了一個工作解決方案,不確定它會被蘋果接受!想法? – Unicorn 2011-01-28 11:06:12
我認爲它不會) – 2011-01-28 12:11:20
這裏是鏈接:http://www.iphonedevsdk.com/forum/iphone-sdk-development/22289-possible-retrieve-these-information.html – Unicorn 2011-01-28 12:20:24