1:安装 mac ports

2:安装DPKG, 在终端输入sudo port -f install dpkg即可安装

3:安装theos

Theos是一个基于Make的编译环境,我们正是用它来编译生成deb文件的。

从该网站下载https://github.com/DHowett/theos,然后解压到你的保存目录下。

配置环境变量   export THEOS = /opt/theos 参考第5步的配置变量方法

4: 下载安装IOSOpenDev,

安装失败可以参考https://github.com/kokoabim/iOSOpenDev/wiki/Troubleshoot

5:还不能正常编译,你需要动态编译环境才能正常编译你的工程

可以参考这篇文章 https://github.com/kokoabim/iOSOpenDev/wiki/Setup-Explained

6:在你的手机设备安装OpenSSH

然后就可以建工程,

为了方便的调试,还要在工程里设置一些参数.这里介绍下这些参数的意义.首先打开程序设置TARGETS里的工程

  1. iOSOpenDevCopyOnBuild 布尔值YES/NO 默认是NO,是否把生成的可执行文件拷贝到/var/root/iOSOpenDevBuilds/[project name]/[executable name] 路径下.是为了方便那些远程SSH控制的程序,可能暂时用不到.
  2. iOSOpenDevDevice 设置你设备的IP.
  3. iOSOpenDevInstallOnProfiling 布尔值 默认为YES, 是否在build for profiling的时候直接远程安装到设备上.
  4. iOSOpenDevPath 不要修改此项,是iOSOpenDev的安装路径.
  5. iOSOpenDevRespringOnInstall 布尔值 默认为YES,是否在安装后重启SpringBoard.
  6. iOSOpenDev默认安装在/opt/iOSOpenDev里,在里面可以找到undocument api的头文件.

    编译的时候不能像正常的App点Run,点击Product->Build For->Build For Profiling.配置好上面的设备IP,程序会自动安装到设备里.

在privateFrameworks 下,苹果明确申明不能使用的API

class-dump可以从编译后的Objective-C的二进制文件中提取对应的数据结构及函数等声明
DumpFrameworks.pl是一个脚本,会在你的主目录下生成private的.h文件
DumpFrameworks.pl下载地址:http://ericasadun.com/HeaderDumpKit/
用法:
1 将下载好的 class-dump 放入usr/local/bin 下. 
2 将DumpFrameworks.pl 放入任意目录下.同样需要修改执行权限.
3. OK..现在所有的准备工作作好了. 我们在 terminal 的任意目录下 输入 : ./DumpFrameworks.pl
有一个Heards 文件夹在你的主目录下. 里面包含了 Frmeworks 和 privateFrameworks 下所有的私有 API

导出的时候注意一下SpringBoard的路径,这里导出ios5.0的如下:

class-dump -H /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/CoreServices/SpringBoard.app -o /Users/x/Desktop/SpringBoard

执行完命令之后就会生成.h文件了

然后把头文件拷贝到

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/include/SpringBoard/

并将substrate.h移动到/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/include/目录下

substrate.h文件的代码如下:

 #ifndef SUBSTRATE_H_
#define SUBSTRATE_H_ #ifdef __cplusplus
extern "C" {
#endif
#include <mach-o/nlist.h>
#ifdef __cplusplus
}
#endif #include <objc/runtime.h>
//#include <objc/message.h>
#include <dlfcn.h> #ifdef __cplusplus
#define _default(value) = value
#else
#define _default(value)
#endif #ifdef __cplusplus
extern "C" {
#endif void MSHookFunction(void *symbol, void *replace, void **result);
IMP MSHookMessage(Class _class, SEL sel, IMP imp, const char *prefix _default(NULL)); #ifdef __cplusplus
}
#endif #ifdef __cplusplus template <typename Type_>
static inline Type_ *MSHookMessage(Class _class, SEL sel, Type_ *imp, const char *prefix = NULL) {
return reinterpret_cast<Type_ *>(MSHookMessage(_class, sel, reinterpret_cast<IMP>(imp), prefix));
} template <typename Type_>
static inline void MSHookFunction(Type_ *symbol, Type_ *replace, Type_ **result) {
return MSHookFunction(
reinterpret_cast<void *>(symbol),
reinterpret_cast<void *>(replace),
reinterpret_cast<void **>(result)
);
} template <typename Type_>
static inline void MSHookFunction(Type_ *symbol, Type_ *replace) {
return MSHookFunction(symbol, replace, reinterpret_cast<Type_ **>(NULL));
} template <typename Type_>
static inline void MSHookSymbol(Type_ *&value, const char *name, void *handle) {
value = reinterpret_cast<Type_ *>(dlsym(handle, name));
} template <typename Type_>
static inline Type_ &MSHookIvar(id self, const char *name) {
Ivar ivar(class_getInstanceVariable(object_getClass(self), name));
void *pointer(ivar == NULL ? NULL : reinterpret_cast<char *>(self) + ivar_getOffset(ivar));
return *reinterpret_cast<Type_ *>(pointer);
} #endif #define MSHook(type, name, args...) \
static type (*_ ## name)(args); \
static type $ ## name(args) \ #define Foundation_f "/System/Library/Frameworks/Foundation.framework/Foundation"
#define UIKit_f "/System/Library/Frameworks/UIKit.framework/UIKit"
#define JavaScriptCore_f "/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore"
#define IOKit_f "/System/Library/Frameworks/IOKit.framework/IOKit" #endif//SUBSTRATE_H_

然后把网上下载的libsubstrate.dylib复制到:

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/

目录下。

导入完成,剩下的就是在工程中加入libsubstrate.dylib,引入头文件了。

最新文章

  1. 线段树 HDU 3308
  2. 在Android项目中引入MuPdf
  3. 高性能网站架构设计之缓存篇(5)- Redis 集群(上)
  4. 快速入门系列--WebAPI--03框架你值得拥有
  5. codeforces 496B. Secret Combination 解题报告
  6. Revit如何修改三维视图背景色
  7. protoc的protoc-gen-grpc-java插件
  8. 自定义 SharePoint 2010 快速启动栏和顶部链接栏
  9. iOS -一些常用的方法
  10. uva-10487 - Closest Sums
  11. PHP中的MVC
  12. 在Java中编写带占位符的SQL语句
  13. WPF动态改变主题颜色
  14. rest服务器
  15. ssh 免密钥失败原因
  16. 通俗易懂的分析如何用Python实现一只小爬虫,爬取拉勾网的职位信息
  17. GROUP BY 的实现与优化
  18. sql查询重复值
  19. 7. Reverse Integer Add to List★
  20. Mybatis3.2不支持Ant通配符TypeAliasesPackage扫描的解决方案

热门文章

  1. 学大伟业Day解题报告
  2. Android ijkplayer在windows下编译并导入Android Studio
  3. 关于cook操作
  4. HDU 2633 Getting Driving License(模拟)
  5. HTML5多维度数据分析
  6. JavaScript的子集和超集
  7. 11.使用 package.json
  8. js ---- 实现千位分隔符
  9. beego的orm ,用的数据库sqlite3
  10. 【问题】VUE 同一页面路由参数变化,数据不刷新