获取所有已安装应用程序的列表
我想获取所有已安装应用程序的列表(NSArray)。我的应用程序是越狱应用程序,位于/Applications 中,因此沙箱在那里没有问题。有什么方法可以获取应用商店应用程序列表吗?我已经在其他应用程序(Activator、SBSettings...)中看到过这一点。我不知道如何做到这一点,因为所有应用程序沙箱都有巨大的代码,所以我不知道如何访问沙箱内的 .app 文件夹。
I would like to get a list of all installed apps(NSArray). My app is a jailbreak app and is located in/Applications so Sandbox is no problem there. Is there any way to get a list of app store apps? I've already seen this in other apps (Activator, SBSettings...). I have no idea how to do this, because all of the apps sandboxes have that huge code, so i don't know how it would be possible to access the .app folder inside the sandbox.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用以下代码片段:
You can use this code snippet:
在越狱的 iPhone 上,您只需读取
/Applications
文件夹即可。所有已安装的应用程序都去那里。只需使用NSFileManager
列出/Applications
中的目录即可:On jailbroken iPhones, you can just read the
/Applications
folder. All installed applications go there. Just list the directories in/Applications
usingNSFileManager
:经过一番研究,我发现了一个名为 iHasApp 的框架。这是一个返回包含应用程序名称、标识符和图标的字典的好解决方案: 查看安装了哪些应用
After some research I have found a framework called iHasApp. Here is a good solution to return a dictionary with app name, identifier and icon: Finding out what Apps are installed
还有
AppList 库
,它将为您完成所有脏活:rpetrich/AppList
它被用在很多越狱调整中,所以我不知道为什么以前没有在这里建议它。
仅获取 AppStore 应用程序的一种方法是检查列表中返回的每个应用程序的
isSystemApplication
值。那些值设置为NO
的是常规 AppStore 应用。还有一个函数applicationsFilteredUsingPredicate:predicate
,所以也许甚至可以预先过滤列表。There's also the
AppList library
, which will do all of the dirty work for you:rpetrich/AppList
It's used in a lot of Jailbreak tweaks, so I don't know why it wasn't suggested here before.
One way to get just AppStore apps would be to check the value of
isSystemApplication
for each app returned in the list. Those with the value set toNO
are regular AppStore apps. There's also a functionapplicationsFilteredUsingPredicate:predicate
, so perhaps it would even be possible to filter the list beforehand.