通过构建阶段脚本将 iOS 应用程序从 XCode 部署到 /Applications? (越狱)
我正在开发 Cydia 应用程序。它已经开发了一段时间了,我从来没有遇到过任何问题,直到最近几个月后我才恢复开发。自从我上次处理它以来,有一些事情发生了变化:
- 升级到 Lion
- 移动到 Xcode 4
- 在我的 iPad 上更新到 4.3.5,iPhone 更新到 5.0
根据我所做的研究,我发现结论是我的旧设置有些“不寻常”。我发现配置的应用程序被放入“沙盒目录”/private/var/mobile/Applications
,而获得整个文件系统读取访问权限的系统应用程序则放入 /Applications< /代码>。我猜想,通过使用更新的工具和 Lion,我破坏了赋予我系统范围读取权限的任何内容。因此,我需要有关如何让 Xcode 直接部署到非沙盒系统目录的信息。
但也有一些注意事项。我不想使用安装程序,我希望 Xcode 在构建并运行后自动执行此操作。我还希望能够附加调试器,以便我可以查看控制台。
有这方面经验的任何人都可以教我如何使用构建阶段脚本来执行必要的魔法来获取签名的二进制文件并在每次构建后自动部署它吗?我想这确实是可能的,因为控制台输出是一个非常有价值的工具,开发像 Cydia 本身这样的应用程序太困难了。
感谢您的帮助!
I'm developing a Cydia app. It's been in development for awhile, and I've never had any problems until recently, when I resumed development after a few months. There are a couple of things that have changed since the last time I worked on it:
- Upgraded to Lion
- Moved to Xcode 4
- Updated to 4.3.5 on my iPad, iPhone to 5.0
From the research I've done, I've come to the conclusion that there was something "unusual" about my old setup. I've discovered that provisioned apps get put in the "sandboxed directory" /private/var/mobile/Applications
, and system apps that get read access to the entire filesystem go in /Applications
. I guess from using updated tools and Lion, I broke whatever was giving me system-wide read privileges. So, I need information on how to get Xcode to deploy directly to the non-sandboxed system directory.
There are some caveats though. I don't want to have to use an installer, I want Xcode to do it automatically after Build and Run. I also want to be able to have the debugger attached so I can view the console.
Can anyone with experience in this teach me how to use Build Phase Scripts to do necessary magic to take the signed binary and deploy it automatically after each build? I'd imagine this is indeed possible, because console output is such a valuable tool, that it would be too difficult to develop apps like Cydia itself.
Thank you for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
社区的普遍共识是这是不可取的。类似于 Theos 的构建系统,与设备上的 GDB 以及 syslog 包或 deviceconsole 是许多人正在使用的。
The general consensus among the community is that this isn't desirable. A build system like Theos coupled with on device GDB and either a syslog package or deviceconsole is what many are using.
我添加了一个脚本作为自定义构建阶段。该脚本对应用程序进行签名,创建包,将其复制到手机并安装。
构建阶段是使用 /bin/sh “运行脚本”,我添加了“${PROJECT_DIR}/MyApp/install.sh”
脚本(非常基本 - 无错误处理)如下(替换为适当的值):(
LatestBuild是构建目录的链接)
(ldid与iosopendev项目一起安装)
它可以改进很多 - 但它只适合我的需要
I added a script as custom build phase. The script signs the app, create a package, copy it to the phone and install it.
The Build Phase is "Run a Script" with /bin/sh and I added "${PROJECT_DIR}/MyApp/install.sh"
The scripts (very basic - no error handling) is below (replace with appropriate values) :
(LatestBuild is a link to the build directory)
(ldid is installed with iosopendev project)
It can be improved a lot - but it just works for my needs
我对 xcode 不是特别了解,但像大多数 IDE 一样,我假设以一种或另一种形式,如果您能弄清楚那是什么,您可以让它运行构建后脚本,它就像从那里上传的 scp 命令一样简单可以在应用程序上传到的目录中使用 ldid -S nameofapp 。
如果您想让您的应用程序驻留在 /Applications 中,则可以,但升级到 4.3.5 很可能会迫使您进行系留越狱,我不知道 4.3.5 是否有不受系留的 JB,所以如果您最终不得不这样做,那就很麻烦了重新启动。
至于调试器给 gdb(你可以从 cydia 获取它),它真的很有用:)。我要做的就是让 xcode 运行构建后脚本以使用 scp 上传到您的设备,然后使用 ldid 手动签名,这是我能想到的最简单的方法,除非您有权访问开发人员 idevice。
给我几分钟,我会写一个脚本并尝试描述它是如何工作的,因为我终于得到了一个大部分工作的开放工具链,所以我需要一个人。 :)
一个简单的上传脚本,
您可以使用 sbsettings 找到您的 IP,或者进入设置,点击您的 AP 旁边的蓝色箭头,它会告诉您。
我将其命名为 upload.sh 但您可以将其命名为任何
名称 示例
那么您所要做的就是 ssh 登录并使用 ldid -S nameofapp 进行签名
如果您想上传单个文件,请删除 -r 作为递归上传(即文件夹)
的原因您必须使用 scp 或 sftp 来上传文件的原因是,如果不使用第 3 方应用程序,则不支持普通 ftp AFAIK。
我不知道如何与 Xcode 集成,我用 vi、emacs 或 nano 做所有事情(而且我没有 mac)。
I'm not particuralry well knowledgable about xcode but like most IDE's im assuming in one shape or another that you can have it run a post build script if you can figure out what that is its as simple as an scp command to upload from there you can use ldid -S nameofapp in the dir that the app is uploaded to.
You can if you want allow your app to reside in /Applications though upgrading to 4.3.5 most likely forces you on a tethered Jailbreak I'm not aware of an untethered JB for 4.3.5 so thats a hassle if you wind up having to reboot.
As far as debuggers give gdb(you can get it from cydia) a go its really useful :). What Id do is just have xcode run a post build script to use scp to upload to your device then sign it manually with ldid thats the easiest way i can think of unless you have access to a developer idevice.
Give me a few minutes Ill write a script and try to describe how it works I need one anyone since i finally got a mostly working open toolchain. :)
A simple upload script
you can find your ip with sbsettings or by going to settings tap the blue arrow next to your ap and it will tell you.
i named it upload.sh but you can name it anything
An example
Then all you do is ssh in and sign it with ldid -S nameofapp
If you want to upload single files remove -r as thats for recursive uploads(ie folders)
the reason that you must use scp or sftp for uploading files is that normal ftp AFAIK is not supported with out the use of 3rd party apps.
I'm not sure how to integrate with Xcode I do every thing with either vi, emacs or nano(and I don't own a mac).