World::Create()

AvatarProgramming ramblings with some vague emphasis on Games, Games Tools and Web.

Debugging on the iPhone

There are some pretty esoteric settings available in all compilers and IDEs, and I've never much cared to get involved in them. However, sometimes these things are forced upon you. Like when I've was programming for the iPhone and debugging just stopped working one day. For the life of me I couldn't work out what I was doing wrong and why it wasn't working. I tried resetting the phone, XCode and my machine, but it didn't seem to make any difference.

Eventually I worked it out. I'd switched profile to try out a distribution build so that I could test installing the app through iTunes. To do this you have to screw with your settings and create a file called Entitlements.plist which has one boolean property get-task-allow. I've no idea what this value is for, but there are a couple of very important rules to learn about when running your app.

1) If you are building using a development profile, then get-task-allow should be set to true.

2) If you are using a distribution profile then you must set get-task-allow to false.

Also, and this is the bit that got me stuck for hours. Even if you are building with the debug configuration in XCode; if you are using a distribution profile you will not be able to debug. The debugger will quit with one of the delightfully useless messages of:

putpkt: write failed: Broken pipe.

or perhaps:

invalid hex digit: 116

Just switch back to your developer profile and breakpoints should start to work again.