网上看到说是在:/var/mobile/Library/com.apple.itunesstored/itunesstored2.sqlitedb
这个路径下,但我在其中并未找到信息,我的系统是iOS 7.1.2
请问在哪能得到这些信息?
是在越狱iOS上做吗?
猥琐一点:遍历/var/mobile/Applications/XXX/XXX.app/Info.plist;
优雅一点:SpringBoard中通过SBApplicationController拿到所有SBApplication,从中取出bundle ID
已经解决,谢谢
大大 我也在做这个类似的东西 根据程序显示名称来找bundleidentity 现在我hook了springboard的applicationDidFinishLaunching方法 然后我简化了SBApplicationController.h SBDisplay.h SBApplication.h代码如下
#import <Foundation/Foundation.h>
@interface SBApplicationController : NSObject
+(SBApplicationController*)sharedInstance;
-(NSArray*)allApplications;
@end
#import <Foundation/Foundation.h>
@interface SBDisplay : NSObject
@end
#import <Foundation/Foundation.h>
#import “SBDisplay.h”
@interface SBApplication : SBDisplay
-(NSString*)bundleIdentifier;
-(NSString*)path;
-(int)dataUsage;
-(BOOL)isSystemApplication;
-(BOOL)isSystemProvisioningApplication;
-(BOOL)isWidgetApplication;
-(NSString*)displayName;
-(NSString*)longDisplayName;
-(void)markLaunchTime;
-(pid_t)pid;
-(NSString*)launchdJobLabel;
-(NSString*)pathForIcon;
-(NSString*)pathForSmallIcon;
@end
然后我在要用的地方引入头文件 使用如下代码
SBApplicationController *sbApplicationCtrl=[SBApplicationController sharedInstance];
NSArray *appArray=[sbApplicationCtrl allApplications];
NSMutableDictionary *dic=[NSMutableDictionary dictionary];
for(SBApplication *sbApp in appArray)
{
//根据提供的app的显示名称来查找其bundleindentity
NSString *appName=[userinfo valueForKeyPath:@“appName”];
NSString *displayName=[sbApp displayName];
if ([displayName isEqualToString:appName])
{
NSString *bundleIdentifier=[sbApp bundleIdentifier];
int dataUsage=[sbApp dataUsage];
NSNumber *number=[NSNumber numberWithInt:dataUsage];
[dic setObject:bundleIdentifier forKey:@“bundleIdentity”];
[dic setObject:number forKey:@“dataUsage”];
break;
}
}
但是make的时候报错 就是最常见的找不到符号的错误
Undefined symbols for architecture arm64:
"OBJC_CLASS$SBApplicationController", referenced from:
objc-class-ref in ToolCenter.mm.9b4af248.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [obj/ScreenAndRunTarget.dylib.ba964c90.unsigned] Error 1
make[1]: *** [internal-library-all] Error 2
我的手机是7.1.2的环境
SBApplicationController *sbApplicationCtrl=[SBApplicationController sharedInstance];
改成
SBApplicationController *sbApplicationCtrl=%c(SBApplicationController) sharedInstance];
晕死 把这茬忘记了 我是定义了一个对象来完成这些工作的 不是在.xm里面 那我用objc_getclass吧 还有想请问一下SBApplication里面有进程名(也就是mach-o的名吧?)的对象吗?
进程名?就是executable name吧,我印象是有的