IOS越狱开发环境搭建
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里的工程
- iOSOpenDevCopyOnBuild 布尔值YES/NO 默认是NO,是否把生成的可执行文件拷贝到/var/root/iOSOpenDevBuilds/[project name]/[executable name] 路径下.是为了方便那些远程SSH控制的程序,可能暂时用不到.
- iOSOpenDevDevice 设置你设备的IP.
- iOSOpenDevInstallOnProfiling 布尔值 默认为YES, 是否在build for profiling的时候直接远程安装到设备上.
- iOSOpenDevPath 不要修改此项,是iOSOpenDev的安装路径.
- iOSOpenDevRespringOnInstall 布尔值 默认为YES,是否在安装后重启SpringBoard.
iOSOpenDev默认安装在/opt/iOSOpenDev里,在里面可以找到undocument api的头文件.
编译的时候不能像正常的App点Run,点击Product->Build For->Build For Profiling.配置好上面的设备IP,程序会自动安装到设备里.
在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,引入头文件了。
最新文章
- 线段树 HDU 3308
- 在Android项目中引入MuPdf
- 高性能网站架构设计之缓存篇(5)- Redis 集群(上)
- 快速入门系列--WebAPI--03框架你值得拥有
- codeforces 496B. Secret Combination 解题报告
- Revit如何修改三维视图背景色
- protoc的protoc-gen-grpc-java插件
- 自定义 SharePoint 2010 快速启动栏和顶部链接栏
- iOS -一些常用的方法
- uva-10487 - Closest Sums
- PHP中的MVC
- 在Java中编写带占位符的SQL语句
- WPF动态改变主题颜色
- rest服务器
- ssh 免密钥失败原因
- 通俗易懂的分析如何用Python实现一只小爬虫,爬取拉勾网的职位信息
- GROUP BY 的实现与优化
- sql查询重复值
- 7. Reverse Integer Add to List★
- Mybatis3.2不支持Ant通配符TypeAliasesPackage扫描的解决方案