开发者

Deploying iOS apps to /Applications from XCode via build phase script? (Jailbroken)

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:

  1. Upgraded to Lion
  2. Moved to Xcode 4
  3. 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!


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.


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)

cd $HOME/Projects/iPhone/MyProject/MyApp
cp -r ../LatestBuild/MyApp.app com.test.MyApp/Applications/ 
ldid -S com.test.MyApp/Applications/MyApp.app/MyApp
rm com.test.MyApp.deb 2>&1
/opt/local/bin/dpkg-deb -b com.test.MyApp
scp com.test.MyApp.deb root@192.168.0.10:/var/root
ssh root@192.168.0.10 "dpkg -r com.test.MyApp"
ssh root@192.168.0.10 "dpkg -i com.test.MyApp.deb"
ssh root@192.168.0.10 "killall -9 MyApp"
#ssh root@192.168.0.10 "killall -HUP SpringBoard"
cd -

It can be improved a lot - but it just works for my needs


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

#!/bin/bash
scp -r $1 $2@$3:$4

$1 is lets say your app folder ill use my dpatcher as an example

$2 is user name either mobile or root(if you upload as root you need to chmod permissions to 755)

$3 is your idevices local ip(ie your routers ip for it) 

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.

$4 is where you want it to be most likely /Applications or /var/mobile/Applications

i named it upload.sh but you can name it anything

An example

upload.sh dpatcher.app mobile@192.168.1.65 /Applications

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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜