获取系统私有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. Unix环境链接静态库

    静态库 请点评 有时候需要把一组代码编译成一个库,这个库在很多项目中都要用到,例如libc就是这样一个库,我们在不同的程序中都会用到libc中的库函数(例如printf),也会用到libc中的变量(例 ...

  2. JS正则汇总

    1.基本定义: \s:用于匹配单个空格符,包括tab键和换行符; \S:用于匹配除单个空格符之外的所有字符; \d:用于匹配从0到9的数字; \w:用于匹配字母,数字或下划线字符; \W:用于匹配所有 ...

  3. 学习android的博客

    http://www.cnblogs.com/hll2008/http://svn.apache.org/repos/asf/http://blog.csdn.net/chenzheng_javaht ...

  4. 数据库(.udl)简单测试连接

    当我们烦于打开数据库进行连接的时候,我们可以用udl进行测试连接,并可以获得连接字符串. 1.新建一个txt文件,然后将后缀改成udl保存. 2.双击打开udl文件. 3.进行数据库连接测试. 4.用 ...

  5. poj 1062(有限制的最短路)

    题目链接:http://poj.org/problem?id=1062 思路:要求对于最短路上的点,不能出现等级之差大于m,于是我们可以枚举,假设酋长的等级为level,于是这个区间范围[level- ...

  6. hdu 2389(最大匹配bfs版)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2389 思路:纯裸的一个最大匹配题,不过悲摧的是以前一直用的dfs版一直过不了,TLE无数次啊,然后改成 ...

  7. (转载)C++ ofstream和ifstream详细用法

    原文出自[比特网],转载请保留原文链接:http://soft.chinabyte.com/database/460/11433960.sh [导读] ofstream是从内存到硬盘,ifstream ...

  8. ffplay 中filter的使用

    添加字幕:ffplay -vf drawtext="fontfile=arial.ttf: text='Test Text': x=100: y=300: \ fontsize=48: fo ...

  9. JavaPersistenceWithHibernate第二版笔记-第六章-Mapping inheritance-001Hibernate映射继承的方法

    There are four different strategies for representing an inheritance hierarchy: Use one table per co ...

  10. Winsock IOCP模型(四篇)

    http://blog.csdn.net/visualeleven/article/details/6041893 http://blog.csdn.net/visualeleven/article/ ...