iOS - 获取手机安装的应用(iOS11以下)
2019-04-02 本文已影响0人
神灬渐入嘉靜
获取手机安装的应用
Class c =NSClassFromString(@"LSApplicationWorkspace");
id s = [(id)c performSelector:NSSelectorFromString(@"defaultWorkspace")];
NSArray *array = [s performSelector:NSSelectorFromString(@"allInstalledApplications")];
for (id item in array)
{
NSLog(@"%@",[item performSelector:NSSelectorFromString(@"applicationIdentifier")]);
//NSLog(@"%@",[item performSelector:NSSelectorFromString(@"bundleIdentifier")]);
NSLog(@"%@",[item performSelector:NSSelectorFromString(@"bundleVersion")]);
NSLog(@"%@",[item performSelector:NSSelectorFromString(@"shortVersionString")]);
}
iOS11以上版本无法再通过LSApplicationWorkspace获取到信息
作者:iOS_小松哥
链接:https://www.jianshu.com/p/4523eafb4cd4
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。