iOS 获取安装应用程序列表和所有 url scheme

您所在的位置:网站首页 ios获取uri iOS 获取安装应用程序列表和所有 url scheme

iOS 获取安装应用程序列表和所有 url scheme

2023-09-12 10:45| 来源: 网络整理| 查看: 265

由于苹果的限制,在未越狱的 iOS 设备中只能通过私有 api 来获取安装应用列表和所有的 url scheme,在 ios 中可以用获取到的 scheme 来打开对应 app

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@“weixin”]];

也可以获取 bundle id 后通过私有 api 来完成。

1、 iOS 私有 api 的使用

获取 iOS 的私有 api 列表可以自己写个 method browser 或直接查看 https://github.com/nst/iOS-Runtime-Headers, 这里是我们需要使用的 api 所在文件

https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/MobileCoreServices.framework/LSApplicationProxy.h https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/MobileCoreServices.framework/LSApplicationWorkspace.h https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/UIKit.framework/UIImage.h

注意,并不是每个 api 都可以使用,苹果的限制是越来越严的。

然后便是私有 api 的使用,这里介绍一种方法,比如我要使用 LSApplicationWorkspace 中的 allInstalledApplications 方法来获取所有安装程序,首先申明

@interface PrivateApi_LSApplicationWorkspace - (NSArray*)allInstalledApplications; @end

学过c的应该能很好的理解,接着便是在某个地方进行初使化

PrivateApi_LSApplicationWorkspace* _workspace; _workspace = [NSClassFromString(@"LSApplicationWorkspace") new];

然后便可以调用了

NSArray* allInstalledApplications = [_workspace allInstalledApplications];


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3