iphone SprintBoard部分私有API总结(不支持iOS8)
本文介绍iOS SrpintBoard框架的部分私有API,具体包括:
- 获取ios上当前正在运行的所有App的bundle id(不管当前程序是在前台还是后台都可以)
- 获取ios上当前前台运行的App的bundle id(不管当前程序是在前台还是后台都可以)
- 根据ios app的bundle id得到其App名称、图标(不管当前程序是在前台还是后台都可以)
- 直接通过App 的bundle id来运行该App,无需使用url scheme(仅限当前程序在前台时,假如程序在后台能随便运行其他App,那就无敌了@_@)
(1)初始化
void * uikit = dlopen("/System/Library/Framework/UIKit.framework/UIKit", RTLD_LAZY);
int (*SBSSpringBoardServerPort)() =
dlsym(uikit, "SBSSpringBoardServerPort");
p = (mach_port_t *)SBSSpringBoardServerPort();
dlclose(uikit);
sbserv = dlopen(SBSERVPATH, RTLD_LAZY);
(2)获取iphone上所有正在运行的app的bundle id列表
NSArray* (*SBSCopyApplicationDisplayIdentifiers)(mach_port_t* port, BOOL runningApps,BOOL debuggablet) =
dlsym(sbserv, "SBSCopyApplicationDisplayIdentifiers");
NSArray *currentRunningAppBundleIdArray= SBSCopyApplicationDisplayIdentifiers(p,NO,YES);
(3)得到iphone 前台运行的app的bundle id
void* (*SBFrontmostApplicationDisplayIdentifier)(mach_port_t* port,char * result) = dlsym(sbserv, "SBFrontmostApplicationDisplayIdentifier");
char topapp[256];
SBFrontmostApplicationDisplayIdentifier(p,topapp);
currentTopAppBundleId=[NSStringstringWithFormat:@"%s",topapp];
(4)根据iphone app的bundle id得到其app名称
NSString * (*SBSCopyLocalizedApplicationNameForDisplayIdentifier)(NSString* ) = dlsym(sbserv, "SBSCopyLocalizedApplicationNameForDisplayIdentifier"); NSString *strAppName = SBSCopyLocalizedApplicationNameForDisplayIdentifier(strBundleId);
(5)根据iphone app 的bundle id得到其图标
NSData* (*SBSCopyIconImagePNGDataForDisplayIdentifier)(NSString * bundleid) =
dlsym(sbserv, "SBSCopyIconImagePNGDataForDisplayIdentifier");
UIImage *icon = nil;
NSData *iconData = SBSCopyIconImagePNGDataForDisplayIdentifier(bundleid);
if (iconData != nil) {
icon = [UIImage imageWithData:iconData];
}
return icon;
(6)直接通过app 的bundle id来运行该app
在ios中,一个app调起另一个app的方式通常是用url scheme,但是用这个 私有app,可以在不需要url scheme的情况下运行任何app
-(void)openAppByBundleId:(NSString*)bundleId
{
void* sbServices = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices", RTLD_LAZY);
int (*SBSLaunchApplicationWithIdentifier)(CFStringRef identifier, Boolean suspended) = dlsym(sbServices, "SBSLaunchApplicationWithIdentifier");
const char *strBundleId = [bundleId cStringUsingEncoding:NSUTF8StringEncoding];
int result = SBSLaunchApplicationWithIdentifier((__bridge CFStringRef)bundleId, NO);
dlclose(sbServices);
}
iphone SprintBoard部分私有API总结(不支持iOS8)的更多相关文章
- 使用私有api实现自己的iphone桌面,并根据app的使用次数对app排序
使用<iphone SprintBoard部分私有API总结>中提到的api,除了能对app运行次数进行监控以外,还可以实现自己的iphone桌面,并根据app 的使用次数对app图标进行 ...
- 使用私有api统计ios app运行时间及次数
利用<iphone SprintBoard部分私有API总结>中提到的私有API,可以做很多越狱以前实现不了的事情. 比如,利用一个后台运行的app,监控该iphone上所有app的运行次 ...
- iPhone私有API
一.基本知识 iPhone中的API除了公开的API:Published API外(或者叫文档中记录的API:Documented API),还有两类API:私有API:Private API和未公开 ...
- 坑爹的私有API
iOS私有API扫描工作总结 背景 苹果提供的iOS开发框架分PrivateFramework和Framework,PrivateFramework下的库是绝对不允许在提交的iOS应用中使用的,只允许 ...
- ios中通过调试来使用私有api
转自:http://blog.csdn.net/cubepeng/article/details/11284173 OS不允许使用ios私有api,使用私有api可以获得意想不到的效果 ,同时使用私有 ...
- class-dump获取iOS私有api
转自:http://blog.csdn.net/sunyuanyang625/article/details/41440167 获取各类iOS私有api 安装工具class-dump 资源地址http ...
- 怎么获取iOS的私有API
前言 作为iOS开发人员,相信大多数伙伴都对怎么获取iOS的私有API很有兴趣,最近通过查找资料,总结了以下三种方法,希望对你有用. 第一种(class-dump) 不得不说这是一个很棒的工具,安装和 ...
- Apple 如何知道你使用了私有API
大约有三种方式 otool -L这个工具可以清晰的列出你链接所有的库 像IO.Kit是不允许使用的 nm -u 这个工具可以清晰的列出你所有链接符号如 C方法 OC方法 检查所有Selecter的字符 ...
- (iOS)私有API的使用(原创)
最近在做企业级程序,需要搞设备的udid等信息,但是ios7把udid私有化了,不公开使用.所以研究了一下ios的私有api. 调查了一下文章,发现这方面的文章不多,国内更是不全,高手们都懒得写基础教 ...
随机推荐
- mongodb download
https://www.mongodb.org/dl/win32/x86_64-2008plus-ssl
- Go 微服务架构Micro相关概念理解
Micro是一个微服务框架(或者说是工具集):提供了各类组件,解决微服务架构中的不同问题,服务监控.服务发现.熔断机制,负载均衡等等,自己一个个解决这些问题几乎不可能,这时候就需要借助go-micro ...
- Java使用jxl写入Excel文件
首先添加jxl的maven依赖: <!-- https://mvnrepository.com/artifact/net.sourceforge.jexcelapi/jxl --> < ...
- php微信支付企业付款到零钱报错call faild, errorCode:58
这个报错一般是自己证书目录不是绝对目录,正确的目录结构应该是网站根目录下的:“C:\PHPWAMP_IN1\wwwroot\XXXX\XXXX.pem”. 还要注意的是文件夹命名一定 ...
- RESTful架构(Representational State Transfer资源表现层状态转换)
1. 什么是REST REST全称是Representational State Transfer,中文意思是表述(编者注:通常译为表征)性状态转移. 它首次出现在2000年Roy Fielding的 ...
- MySQL简单管理
基础入门 ============管理MySQL========== .查看MySQL版本 mysqladmin --version .启动MySQL /etc/init.d/mysqld start ...
- Linux系统查看CPU使用率命令
在linux的系统维护中,可能需要经常查看cpu使用率,分析系统整体的运行情况.而监控CPU的性能一般包括以下3点:运行队列.CPU使用率和上下文切换. 1.top 这个命令很常用,在第三行有显示CP ...
- 用elasticsearchdump备份恢复数据
1.安装elastic searchdump mkdir /data/nodejs cd /data/nodejs wget https://nodejs.org/dist/v10.16.2/node ...
- 远程桌面teamviewer
1.同一局域网 windows:远程桌面 2.需穿过局域网 teamviewer (1)使用 http://jingyan.baidu.com/article/ff4116259af07d12e482 ...
- 初识gRPC
一.gRPC的概念 gRPC是Google推出的一个开源高性能的轻量级RPC框架,可以在任何环境中运行.它可以有效地连接数据中心内和跨数据中心的服务,并提供可插拔的支持,以实现负载平衡,跟踪,健康检查 ...