最近要写一个项目,需要获取本地应用程序的相关信息。发现在iphone上的设置-用量里可以找到本地应用程序的信息,求有什么代码上的方法实现获取应用信息,除了越狱以外,如果通过向苹果公司申请一些授权可以获取也请帮忙告诉我,多谢~
iOS 本地应用
------解决方案--------------------
估计是没办法了,不知道私有方法里有没有,
就算是有,也通过不了审核的
------解决方案--------------------
用到私有API了
BOOL APCheckIfAppInstalled(NSString *bundleIdentifier){
static NSString *const cacheFileName = @"com.apple.mobile.installation.plist";
NSString *relativeCachePath = [[@"Library" stringByAppendingPathComponent: @"Caches"] stringByAppendingPathComponent: cacheFileName];
NSDictionary *cacheDict = nil;
NSString *path = nil;
NSLog(@"relativeCachePath:%@",relativeCachePath);
// Loop through all possible paths the cache could be in
for (short i = 0; 1; i++) {
switch (i) {
case 0: // Jailbroken apps will find the cache here; their home directory is /var/mobile
path = [NSHomeDirectory() stringByAppendingPathComponent: relativeCachePath];
break;
case 1: // App Store apps and Simulator will find the cache here; home (/var/mobile/) is 2 directories above sandbox folder
path = [[NSHomeDirectory() stringByAppendingPathComponent: @"../.."] stringByAppendingPathComponent: relativeCachePath];
break;
case 2: // If the app is anywhere else, default to hardcoded /var/mobile/
path = [@"/var/mobile" stringByAppendingPathComponent: relativeCachePath];
break;