越狱开发No.2 ldid工具签名app流程

简介:

最近在研究越狱下的iOS开发,经过stackOverFlow上大神以及Google的帮助,总算有了个初步的了解,虽然截止到目前还没有完全成功,ldid工具会报错,但是还是把流程记录下来。

stackOverflow上的帖子在这里:http://stackoverflow.com/questions/12768109/how-to-use-ldid

帖子的提问者先讲了一个大致的步骤:

  1. Disable code signing in XCode.

  2. Built unsigned iPhone app.

  3. Copied it to my iPhone via SSH to location /User/me/development/HelloWorld.app

  4. Now I try to simulate its signing to run this application on iPhone. I run follwing commands:

我们一步一步来看:

首先取消Xcode的签名,然后build一个没有签名的APP。好了,来看另一篇文章,很详细地讲解了如何取消XCode的签名然后build一个app文件出来  。

Step 1:   
GoTo /Applications then right click Xcode.app and click "Show Package Contents"

在“应用程序”中找到Xcode,然后右键,选择“显示包内容”

Step 2:
GoTo Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/
and copy the file SDKSettings.plist to desktop
按照上面的路径,进入7.0的sdk里面。当然,如果你已经升级xcode为6.0+,那么SDKs文件夹下的sdk会变成8.0,不过这并不影响我们接下来工作的进行

Step 3:
Open the file copied SDKSettings.plist. Under <DefaultProperties> ==> <dict>
find <CODE_SIGNING_REQUIRED> and change its value from YES to NO. Save the file
将SDKSettings.plist 文件拷贝出来,然后修改DefauldProperties下面的CODE_SIGNING_REQUIRED 值从YES到NO,然后保存

Step 4:
Copy this modified SDKSettings.plist file back to
   Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/
replacing the orginal file [YOU MAY SAVE THE ORIGINAL FILE AS BACKUP]
Do the required AUTHENTICATION AS REQUIRED
把保存好的plist文件覆盖到原目录下,最好把原来的plist文件备份一份出来,以防万一。
拷贝文件进去的时候需要有个鉴定的步骤

Step 5:
Restart Xcode and open your runnable xcode project
重启Xcode,然后打开project

Step 6:
In Project Navigator select your project and open Build Settings section of your porject and Select All sub-heading.
在Build Settings下面找到 Code Signing (XCode6中是第一项)


Step 7:
Under Code Signing find Code Signing Identity and for both Debug and Release modesset Any iOS SDK to Don't Code Sign.
把Debug和Release下面的4个全部选成Don't Code Sign

To make an IPA:


Step 8:
In Xcode, goto Product and click Archive
然后在Product下面点击Archive

Step 9:
Step7 will build you project and creat an Archive. After the completion of the process, new window Organize - Archive will be opened. In the list of this window you can see your project. Right click project and click Show in Finder which will reveal *.xcarchive file
等待程序打包,因为是一个未签名的APP,所以Archive后会生成一个后缀为xcarchive的文件

Step 10:
Right click the *.xcarchive file and click Show Package Contents and goto Products =>Applications where you will see an app file with the name of your project<projectname>.app
在列表中右键这个xcarchive文件,然后选择显示包内容,在products->Application下面就能看到一个文件夹,我得到的其实就是一个只有名字没有.app后缀的文件夹。但是在终端里面敲代码ls是能看到这个文件夹是有.app后缀的

Step11: 
Open iTunes change view to Apps and drag the app file <projectname>.app  into the iTunes.
把这个文件拷贝出来放到任意一个地方,如果你想安装,就需要把他拖到iTunes里面的应用程序中,

Step12:
Right Click your app, click Show in Finder. There you will have you .ipa file.
右键拖进来的这个app,选择show in Finder,会看到一个.ipa的文件

Important Notes :

1. In Step 8, if the Archive menu is disabled this is most likely because the a simulator option is currently selected as the run target in the Xcode toolbar. Changing this menu either to a connected device, or the generic iOS Device target option should enable the Archive option in Product menu.

2. You will also need to install AppSync in your iPhone via Cydia.

上面的步骤都执行完之后,其实我们就完成了

  1. Disable code signing in XCode.

  2. Built unsigned iPhone app.

这两步,接下来,就需要用到ldid工具了。

按照我的理解,我们可以在Mac OX上或者在iPhone里面利用ldid工具进行签名,这两个地方都是可行的。

在iPhone上使用ldid工具比较简单,去cydia里面搜索ldid,会出来两个插件,第一个Link Identity Editor就是我们要用的ldid,然后安装了之后,在终端上SSH进去你越狱后的iPhone(同样需要在cydia里面安装openSSH插件),命令行是

ssh root@xxx.xxx.xxx.xxx
xxx表示IP地址,关于如何SSH就不在这里介绍了,google一下有很多文章介绍,可以在wifi或者通过数据线连接进入

然后把之前得到的app文件夹拖到一个目录下面,cd到这个目录下,然后执行

ldid -S projectname

这个命令,如果顺利的话,签名就完成了,不幸的是,我总会得到这样的错误提示:

 _assert(false); errno=2 

或者在Mac OX上执行签名

首先需要下载ldid文件, https://github.com/downloads/rpetrich/ldid/ldid.zip
不太确定这个是不是最新的ldid文件,因为有的ldid不能签名fat project(关于这个过会儿再讨论)

然后把它放到/usr/bin路径下,如果找不到这个路径,直接在终端里面输入  open /usr/bin 就可以了

然后执行

chmod -R 777 ldid

关于这个命令上篇文章已经介绍过了,这里就不再重复说明。

接下来就可以使用ldid给之前拖到桌面的app文件签名了,命令同样是 -S+projectname

但是目前我仍然没法正常使用这个命令。

回到之前在stackOverFlow上的那个问题,最佳答案里面提到了fat project的概念,

 Usually, when I get this error, it's because I built my app with the wrong architectures. Most older versions of ldid that I've used cannot sign fat binaries (but see Update below). Fat binaries are ones with more than one architecture inside. For example, a dual armv6 and armv7 executable. Or with Xcode 4.5, it's probably defaulting to arvm7 and armv7s.

In the project build settings, use the ArchitecturesValid Architectures and Build Active Architecture Only settings to determine which architecture executable is built. For jailbreak development, I usually setBuild Active Architecture Only to YES. And valid archictures set to armv6 and armv7.

3) Also, some older versions of ldid cannot sign armv7 executables. If you get the pre-built copy from KennyTM's site here, it supports armv7. Note that this ldid is built for Mac OS X, so it's designed to be run on the executable on your Mac, after building without signing in Xcode, but before you upload to your iPhone.

Newer phones can generally run executables built for older architectures, but not the other way around. So, build for the oldest architecture you want to support. You just will lose some optimizations in the newer architectures (which most people don't care too much about ... let me know if your app needs these optimizations, and I'll post more).

So, if you want to support old devices (iPhone < 3GS), I would set Architectures to only armv6, making sure to remove the default setting of $(ARCHS_STANDARD_32_BIT). If you only need support for relatively new ones, then pick armv7, but make sure you use a version of ldid that can sign armv7binaries.

Edit: to determine if the executable you were trying to sign was a fat one, run this at the command line:

> cd HelloJB.app

> ls
HelloJB     Info.plist  PkgInfo     date.zip    en.lproj

> lipo -info HelloJB 
Non-fat file: HelloJB is architecture: armv7

As you can see in the above output, my HelloJB executable is not fat, and only has armv7 code.

我用同样的命令执行了一遍,发现我的project确实是fat的,里面有armv7和armv64

但是不知道ldid是不是能够支持fat的程序。

关于越狱的东西我会继续搞,如果有进展会再做记录。如果有网友知道如何解决ldid命令失败的原因,请指教,谢谢!


目录
相关文章
|
1月前
|
API 数据安全/隐私保护 iOS开发
利用uni-app 开发的iOS app 发布到App Store全流程
利用uni-app 开发的iOS app 发布到App Store全流程
84 3
|
1月前
|
Android开发 开发者 UED
个人开发 App 成功上架手机应用市场的关键步骤
个人开发 App 成功上架手机应用市场的关键步骤
|
1月前
|
开发工具 数据安全/隐私保护 Android开发
【教程】APP 开发后如何上架?
【教程】APP 开发后如何上架?
|
1月前
|
Java Android开发 开发者
【Uniapp开发】APP的真机调试指南,从开发到上架全过程
【Uniapp开发】APP的真机调试指南,从开发到上架全过程
36 3
游戏直播APP平台开发多少钱成本:定制与成品源码差距这么大
开发一款游戏直播APP平台所需的费用是多少?对于计划投身这一领域的投资者来说,首要关心的问题之一就是。本文将探讨两种主要的开发模式——定制开发与成品源码二次开发的成本差异及其优劣势。
|
1月前
|
开发框架 移动开发 JavaScript
SpringCloud微服务实战——搭建企业级开发框架(四十六):【移动开发】整合uni-app搭建移动端快速开发框架-环境搭建
正如优秀的软件设计一样,uni-app把一些移动端常用的功能做成了独立的服务或者插件,我们在使用的时候只需要选择使用即可。但是在使用这些服务或者插件时一定要区分其提供的各种服务和插件的使用场景,例如其提供的【uni-starter快速开发项目模版】几乎集成了移动端所需的所有基础功能,使用非常方便,但是其许可协议只允许对接其uniCloud的JS开发服务端,不允许对接自己的php、java等其他后台系统。
140 2
|
1月前
|
移动开发 负载均衡 小程序
代驾app开发丨代驾系统开发玩法详情丨代驾系统开发网页版/H5/小程序及源码部署
**司机/代驾员端**:司机可以通过APP接收订单,查看订单详情、路线和导航,提供现场服务并进行确认。
app开发的一些思路
<p><br></p> <p><br></p> <p></p> <h3 style="margin:0px; padding:0px; border:0px; vertical-align:baseline; clear:both; font-weight:normal; list-style:none; color:rgb(102,102,102); font-family:宋体;
2864 0
x3d
小型app开发的思路
前提: 1. 性能不是最重要; 2. 人手少; 3. 速度要快;   结论: 1. 混合式 2. 减少app的复杂程度 3. 追求性能   (博客,尽量让自己每天写一点,短一点都可以)
x3d
537 0
|
1月前
|
API
uni-app 146朋友圈列表api开发
uni-app 146朋友圈列表api开发
18 0