获取系统私有API,网上有很多资料总结了一下就三种方式:

  • 使用class-dump可以提取系统私有API列表
  • 使用class-dump+DumpFrameworks.pl,这个可以一次性提取所有系统Framework与PrivateFrameworks的API列表
  • 直接使用已经提取好的API列表github地址

DumpFrameworks.pl代码如下:

#!/usr/bin/perl
#
# 24 November 2008
# Framework Dumping utility; requires class-dump
# use strict; use Cwd;
use File::Path; my $HOME = (getpwuid($<))[7] || $ENV{'HOME'}
or die "Could not find your home directory!"; # This command must be in your path.
# http://www.codethecode.com/projects/class-dump/
my $CLASS_DUMP = 'class-dump'; # Public Frameworks /xcode4/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk////Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library
# /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks /xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library
dump_frameworks('/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks',
'Frameworks'); # Private Frameworks
dump_frameworks('/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/PrivateFrameworks',
'PrivateFrameworks'); sub dump_frameworks
{
my($dir, $subdir) = @_; opendir(my $dirh, $dir) or die "Could not opendir($dir) - $!"; # Iterate through each framework found in the directory
foreach my $file (grep { /\.framework$/ } readdir($dirh))
{
# Extract the framework name
(my $fname = $file) =~ s/\.framework$//;
print "Framework: $fname\n"; my $headers_dir = "$HOME/Headers/$subdir/$fname"; # Create the folder to store the headers
mkpath($headers_dir); # Perform the class-dump
my $cwd = cwd();
chdir($headers_dir) or die "Could not chdir($headers_dir) - $!"; system($CLASS_DUMP, '-H', "$dir/$file"); if($? == -1)
{
die "Could not execute $CLASS_DUMP - $!\n";
}
#
# elsif($? & 127)
# {
# printf("$CLASS_DUMP died with signal %d, %s coredump\n",
# ($? & 127), ($? & 128) ? 'with' : 'without');
# exit;
# }
#
# elsif(my $ret = $? >> 8)
# {
# die "The command '$CLASS_DUMP -H $dir/$file' failed, returning $ret\n";
# }
#*/
chdir($cwd) or die "Could not chdir($cwd) - $!";
}
}

注意使用DumpFrameworks.pl时要更改系统库的路径为你自己的路径。


但是从class-dump官网下载的最新版本class-dump-3.5.dmg却不能获取iOS9以后版本的API列表。报错信息:

Warning: This file does not contain any Objective-C runtime information.

具体原因Google了一下:

class-dump依赖于__DATA段下的几个sect里的数据。

iOS9 dyld解包的生成macho不在标准__DATA段,导致某些classdump无法识别

原答案地址

然后我从github上获取class-dump开源代码重新编译class-dump的可执行文件,并把这个可执行文件导出重新dump成功获取iOS9以后的系统私有API。具体方法如下:

1.打开class-dump并在TARGETS选中class-dump可执行文件

2.Xcode->Perferences->Locations

3.Advanced->Custom

不要更改任何路径选择后编译该项目。

编译成功后在~Library/Developer/Xcode/DerivedData/Build/Products可以找到这个可执行文件然后用这文件获取系统私有API。

iOS9 class dump header的更多相关文章

  1. 数据备份--dump(此作者有许多有用的博客文章)

    数据中 心操作大量的数据.当遭到破坏时,这就是一场灾难.这时候需要备份来恢复,及时你又大量的备份数据都没用,备份也肯定不是在浪费时间.你也许很幸运从 来没有经历过数据丢失.但是, 由于这种事情极少发生 ...

  2. Linux完整备份工具 - dump, restore(现在基本不用这两个)

    dump 其实 dump 的功能颇强,他除了可以备份整个文件系统之外,还可以制定等级喔!什么意思啊! 假设你的 /home 是独立的一个文件系统,那你第一次进行过 dump 后,再进行第二次 dump ...

  3. undo损坏故障恢复(二)ORA-01092,ORA-00604,ORA-01110

    undo 故障诊断与恢复(二) 今天是2013-09-01,目前困扰我将近一周的问题,终于解决了,我非常感谢帮助我的朋友,也非常感谢管我要钱然后替我解决问题的朋友(我没采用).这更激发了我一定要解决这 ...

  4. 理解 B*tree index内部结构

    转载请注明出处:http://write.blog.csdn.net/postedit/40589651 Oracle数据库里的B树索引就好象一棵倒长的树.它包括两种类型的数据块:一种是索引分支块,还 ...

  5. Oracle 如何提交手册Cluster Table事务

    环境遇到ora-00600 4000错误,该目的是参与cluster table,什么我这里有以下简单的模拟.以供参考! ++++创建一个测试表 ? 1 2 3 4 5 6 7 8 9 10 11 1 ...

  6. 【BBED】BBED模拟并修复ORA-08102错误

    [BBED]BBED模拟并修复ORA-08102错误 1.1  BLOG文档结构图 1.2  前言部分 1.2.1  导读和注意事项 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其 ...

  7. pt-show-grants

    用法: pt-show-grants [OPTION ... ] [DSN]   例子: pt-show-grants pt-show-grants --separate --revoke | dif ...

  8. pt-show-grants的用法

    pt-show-grants的用法 1.先查找所有用户和Host 2.然后逐个执行show grants pt-show-grants的功能是格式化打印输出MySQL上的赋权,以便你可以有效地复制.比 ...

  9. Oracle降低高水位先(转载)

    Oracle  降低高水位线的方法 高水位(HIGH WARTER MARK,HWM)好比水库中储水的水位,用于描述数据库中段的扩展方式.高水位对全表扫描方式有着至关重要的影响.当使用DELETE删除 ...

随机推荐

  1. YARN-RPC

    运行在YARN平台上面的RPC. 当前存在非常多的开源RPC框架,比较著名的有Thrift.Protocol Buffers 和 AVRO.他们均有两部分构成:对象序列化和远程过程调用. 重要类: Y ...

  2. HDOJ 1085 Holding Bin-Laden Captive! (母函数)

    Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja ...

  3. (转)Tips for Optimizing C/C++ Code

    本来要自己翻译的,随手搜索了一下,发现五天前已经有人翻译了,我就不重复发明轮子了. 转自:http://blog.csdn.net/yutianzuijin/article/details/26289 ...

  4. cf div2 239 D

    D. Long Path time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  5. Git 10 周年之际,创始人 Linus Torvalds 访谈

    点这里 十年前的这一周,linux 内核社区面临一个根本性的挑战:他们不再能够使用他们的修复控制系统:BitKeeper,同时其他的软件配置管理遇到了对分布式系统的新需求.Linus Torvalds ...

  6. HDU 1869 六度分离

    六度分离 http://acm.hdu.edu.cn/showproblem.php?pid=1869 Problem Description 1967年,美国著名的社会学家斯坦利·米尔格兰姆提出了一 ...

  7. iOS多线程的初步研究(九)-- dispatch源

    dispatch源(dispatch source)和RunLoop源概念上有些类似的地方,而且使用起来更简单.要很好地理解dispatch源,其实把它看成一种特别的生产消费模式.dispatch源好 ...

  8. 安装mysql之后,存入中文出现乱码 02

    现在出现这个问题,将编码字符串改成utf8 之后 数据表 还是不能存储中文. 看如下两张图,应该会有启发: 这下应该明白了吧.

  9. ExtJs之Ext.core.Element

    <!DOCTYPE html> <html> <head> <title>ExtJs</title> <meta http-equiv ...

  10. ExtJs之进度条实现

    慢慢按书上的作. <!DOCTYPE html> <html> <head> <title>ExtJs</title> <meta h ...