Developing with Jailbroken iPhone (Xcode)

hetelek picture hetelek · Jun 1, 2012 · Viewed 12k times · Source

I have a jailbroken iPhone 4S with the running iOS 5.1.1. I have Xcode 4.3.2, and I have been able to run my apps to my iPhone, but in a weird way. If I click the debug button on Xcode, it attempts to open the app on my jailbroken iPhone, but fails because it quickly opens and then closes. Even though this happens, if I open the app manually, by clicking it on the homescreen, it runs fine. That's pretty annoying. The most annoying thing is that this causes it to no longer allow debugging, as Xcode doesn't see that it is running.

This is the output that it produces:

error: failed to launch '/Users/hetelek/Library/Developer/Xcode/DerivedData/spyapp-flynnmpiqhjoilezvqsbaqdnkesn/Build/Products/Debug-iphoneos/spyapp.app/spyapp' -- failed to get the task for process 3741

With the process ID changing every time of course.

This is the tutorial I used for developing on my jailbroken iDevice: http://iphonedevwiki.net/index.php/Xcode#Developing_without_Provisioning_Profile

Thanks for any help.

Answer

Andrew R. picture Andrew R. · Jun 4, 2012

I'd try stepping through that tutorial again just to make sure you ran through the setup correctly. It seems like you can install the apps without issue, but the debugger just can't attach to the app after installation. If you really need the debugger, you could try instead opening the app on your device after installation, and then while it's running (and your device is plugged in to your Mac running Xcode), open Xcode and go to Product -> Attach to Process, and select your app from the list (if it isn't there, that's a whole other issue).

Also, try YllierDev's suggestion of enabling get-task-allow in your app's Entitlements file (if it doesn't have one, you can easily create one from your project's Info page in Xcode). Assuming you went through the tutorial correctly, that should help.

--

To enable the 'get-task-allow' in your app's Entitlements file with Xcode 4.3, do the following:

  1. Click your project under the project navigator, and select the name of your project under the 'Targets' column.
  2. Next, go to the summary tab, and under 'Entitlements', check 'Enable Entitlements'.
  3. Next, right click/command click the 'YOURAPP.entitlements' file under the project naviagtor, and select 'Show in Finder'.
  4. Open in in TextEdit, and add:

    <key>get-task-allow</key> <true/>

    right before </dict>.

  5. It should now debug and run fine!