Search code examples
iphoneiosipadpermissionsjailbreak

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!


Solution

  • 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