用iOSOpenDev在Xcode里配置越狱开发环境
在iosOpenDev之前,很多ios插件都使用theos编译开发,用theos开发比较麻烦,还需要用class—dump导出私有的API;然后自己手写Makefile文件,也没有IDE,还要自己找编辑器,自从出现了iosOpenDev这些东东统统的都被解决了,另外它还会为你的项目打包成一个.deb文件。iOSOpenDev可以在XCode里写越狱的程序,整体和写正常的App差不多.还能自动传送到设备里调试.大大降低了越狱程序的开发。本教程共分为三大部分:一.Mac安装工具,二.ios设备插件安装,三.连接调试
一.Mac安装工具
1. 首先安装MacPorts.MacPorts类似于Ubuntu的aptitude或者python的easyInstall.验证安装的方法是在Terminal里输入port,看看有没这个命令.下载文件和安装方法请参照:http://www.macports.org/install.php
(说明:安装macports的时候,根据自己的系统版本安装下载对应的macPorts进行安装)
2.安装dpkg.在Terminal里输入 “sudo port -f install dpkg”会安装很长时间的,让他自己慢慢装就行了.这个是把程序打包成.deb文件用的.
3.安装iOSOpenDev
自己查找原因。(说明:安装iOSOpenDev
安装成功后打开Xcode会看到如下界面:
到此你就可以建立自已的第一个程序:Hello World
二.ios设备需要安装的插件:(以下是需要在越狱设备上边的安装的插件)
最后还得有个真机进行调试,首先你的设备需要安装下列插件:
Core Utilities
CoreUtilities(/bin)
diskdev-cmds
file-cmds
system-cmds
Mobileterminal
openSSH
sshpass
toggle ssh
preferenceloader
substrate safemode
syslogd to /var/log/syslog
4. 在设备上安装OpenSSH并 且在设备上添加SSH签名.在Cydia里搜索OpenSSH安装.建议更改SSH的默认密码,默认密码是:alpine.更改方法是在Mac上登陆设备 的SSH.命令”ssh root@<设备IP>”.登陆后输入命令”passwdroot”.输入新密码,注意是密文.
5. 给SSH添加签名,在Mac的Terminal里输入”
三.连接调试:
1、iOSOpenDevCopyOnBuild布尔值YES/NO 默认是NO,是否把生成的可执行文件拷贝到/var/root/iOSOpenDevBuilds/[project name]/[executable name] 路径下.是为了方便那些远程SSH控制的程序,可能暂时用不到.
2、iOSOpenDevDevice设置你设备的IP(例如:192.168.1.10).
3、iOSOpenDevInstallOnProfi
4、iOSOpenDevPath不要修改此项,是iOSOpenDev的安装路径.
5、iOSOpenDevRespringOnInst
6、iOSOpenDev默认安装在/opt/iOSOpenDev里,在里面可以找到undocumentapi的头文件.
编译的时候不能像正常的App点Run,点击Product->Build For->Build For Profiling.配置好上面的设备IP,程序会自动安装到设备里.
接下来就开始写个越狱程序试试吧!
注意:我自己的xcode环境是5.02,但是无法自动安装到手机上,不过可以把项目中生成的deb格式的安装包手动通过itools工具(mac上的软件)上传到手机上任意目录,然后通过iFile(iPhone上工具软件)来安装它注意事项:如果编译遇到“target specifies product type ‘com.apple.product-type.library.dynamic’, but there’s no such product type for the ‘iphoneos’ platform”则说明是xcode没有开启支持动态链接库的功能,需要手动修改xcode的的系统文件,如下:
通过Mac App Store安装的文件路径为:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Specifications/iPhoneOSProductTypes.xcspec
增加内容:
// Dynamic library
{ Type = ProductType;
Identifier = com.apple.product-type.library.dynamic;
Class = PBXDynamicLibraryProduct
Name = “Dynamic Library”;
Description = “Dynamic library”;
IconNamePrefix = “TargetPlugin”;
DefaultTargetName = “Dynamic Library”;
DefaultBuildProperties = {
FULL_PRODUCT_NAME = “$(EXECUTABLE_NAME)”;
MACH_O_TYPE = “mh_dylib”;
REZ_EXECUTABLE = YES;
EXECUTABLE_SUFFIX = “.$(EXECUTABLE_EXTENSION)”;
EXECUTABLE_EXTENSION = “dylib”;
PUBLIC_HEADERS_FOLDER_PATH = “/usr/local/include”;
PRIVATE_HEADERS_FOLDER_PATH = “/usr/local/include”;
INSTALL_PATH = “/usr/local/lib”;
DYLIB_INSTALL_NAME_BASE = “$(INSTALL_PATH)”;
LD_DYLIB_INSTALL_NAME =
“$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)”;
DYLIB_COMPATIBILITY_VERSION = “1″;
DYLIB_CURRENT_VERSION = “1″;
FRAMEWORK_FLAG_PREFIX = “-framework”;
LIBRARY_FLAG_PREFIX = “-l”;
LIBRARY_FLAG_NOSPACE = YES;
STRIP_STYLE = “debugging”;
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
CODE_SIGNING_ALLOWED = YES;
};
PackageTypes = (
com.apple.package-type.mach-o-dylib // default
);
},
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Specifications/iPhoneOSPackageTypes.xcspec
增加:
// Mach-O dynamic library
{ Type = PackageType;
Identifier = com.apple.package-type.mach-o-dylib;
Name = “Mach-O Dynamic Library”;
Description = “Mach-O dynamic library”;
DefaultBuildSettings = {
EXECUTABLE_PREFIX = “”;
EXECUTABLE_SUFFIX = “”;
EXECUTABLE_NAME =
“$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)”;
EXECUTABLE_PATH = “$(EXECUTABLE_NAME)”;
};
ProductReference = {
FileType = compiled.mach-o.dylib;
Name = “$(EXECUTABLE_NAME)”;
IsLaunchable = NO;
};
},
上面的操作针对Xcode 4.5之前的版本,Xcode 4.5之后,这两个文件已变成plist存储格式,使用Xcode打开这两个文件,按照plist格式来操作增加上面的内容即可,plist修改之后的文件已经上传到百度云