越狱开发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 Architectures, Valid 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命令失败的原因,请指教,谢谢!


目录
相关文章
|
缓存 移动开发 JavaScript
如何优化UniApp开发的App的启动速度?
如何优化UniApp开发的App的启动速度?
1992 139
|
移动开发 前端开发 Android开发
【02】建立各项目录和页面标准化产品-vue+vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
【02】建立各项目录和页面标准化产品-vue+vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
2265 12
【02】建立各项目录和页面标准化产品-vue+vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
|
移动开发 JavaScript 应用服务中间件
【06】优化完善落地页样式内容-精度优化-vue加vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
【06】优化完善落地页样式内容-精度优化-vue加vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
1439 5
【06】优化完善落地页样式内容-精度优化-vue加vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
|
人工智能 前端开发 JavaScript
最佳实践3:用通义灵码开发一款 App
本示例演示使用通义灵码,基于React Native与Node.js开发跨平台类通义App,重点展示iOS端实现。涵盖前端页面生成、后端代码库自动生成、RTK Query通信集成及Qwen API调用全过程,体现灵码在全栈开发中的高效能力。(238字)
1266 11
|
移动开发 Android开发
【03】建立隐私关于等相关页面和内容-vue+vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
【03】建立隐私关于等相关页面和内容-vue+vite开发实战-做一个非常漂亮的APP下载落地页-支持PC和H5自适应提供安卓苹果鸿蒙下载和网页端访问-优雅草卓伊凡
777 0
APP开发的流程有哪些?
APP开发的过程当中,多多少少的也要遵循着自己的流程,从现有的一些情况来看,大多数的情况下再开发的过程当中加入着各种不同的开发方案,那么他们的流程究竟如何?
658 0
|
测试技术 UED
app开发流程有哪些
  app开发流程是需求方和供求方相互协调的过程,一般分为需求分析、功能设计、功能实现、项目测试、上线等几个步骤,下面我们就来一起看看ytkah团队进行app开发各个流程主要做哪些事情,让您对app开发设计有一个更全面的了解,更放心地将项目交予我们来为您实施。
2810 0
|
移动开发 JavaScript weex
UniApp开发的App在启动速度方面有哪些优势和劣势?
UniApp开发的App在启动速度方面有哪些优势和劣势?
947 137
|
移动开发 小程序 Android开发
基于 uni-app 开发的废品回收类多端应用功能与界面说明
本文将对一款基于 uni-app 开发的废品回收类多端应用,从多端支持范围、核心功能模块及部分界面展示进行客观说明,相关资源信息也将一并呈现。
456 0

热门文章

最新文章