Hopefully this will provide some useful information for someone, because I did a lot of google searching and didn’t come up with an answer to this one that way.
After upgrading my sdk from 2.2.1 to 3.0 beta 5 I was no longer able to install my application on the iPhone. The compile, link, build and install process went fine but as soon as the application was launched, and before it got to main(), the app crashed. In the debugger I was getting putpkt: write failed: Broken pipe.
After hours (and hours) of various tests, back tracking, deleting, re-installing, restoring and other contortions I finally remembered that several weeks back I had added an entitlements plist to solve a similar issue. So, I deleted the reference to the plist from my project settings entitlement field, and it worked!.
That is, until I went to make a distribution build, at which time it failed again. However, this time it gave me the old, familiar error about an invalid entitlement. So, I re-added the entitlement plist reference and the ad-hoc installation worked.
Hopefully the final 3.0 SDK will correct this issue so that I don’t have to remember to do this each time I switch between development and distribution builds.


How this broke actually and how it happen
Well, it didn’t actually “Break”, per se, what happened is that starting with the 3.0 SDK you can no longer have a distribution plist for debugbuilds, but they are required for ad-hoc or app store builds.
My solution is to have four build configurations:
- debug
- release
- adhoc
- distribution
This setup allows me to have debug/release use no distribution plist and my development profile, while the adhoc and distribution do have the plist and then each has their own profile. Works very well.
This error also seems to occur if you build and debug whilst the application is already running on the iPhone.
you saved me all sorts of time and frustration. thanks for putting the tip out there.
I’m afraid I spoke too soon. It did help, but only for one program run. There is something else going on here.
Solved! I have been able to reliably avoid this error completely:
1. Before doing a new build, always stop the debugger first.
2. Then stop the app on the device.
3. Only after doing the above 2 steps, then build and go.
That’s all you need. (No need to restart Xcode, restart device, delete app from device, etc.)
Forrest
PS. This is bug in XCode.
Hey All
i am also facing this problem but this problem happened with me in UITableViewCell.
when i am scrolling the table view, not always but sometimes it crashed and displays the above error in degub console.
please help me what may be the reason.
Asad,
I am not sure why scrolling a tableview would result in a broken pipe, although in combination with the “sometimes” symptom my first thought is a bad pointer leading to a memory overwrite.
Try turning on Guard Malloc in the run menu; your program will run really slow but it’s likely to find any memory issues.