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.

Lane Roathe

I make my living designing, producing, and programming computer software. I have done work on numerous platforms, including MacOS, Win95/NT, Apple //, Super Nintendo, Sega, and others; writing mainly games but also operating systems, applications, utilities, etc. I have started and run several companies, currently operating Ideas From the Deep.

8 Responses to “putpkt: write failed: Broken pipe”

  1. weed Pipes says:

    How this broke actually and how it happen

  2. Lane Roathe says:

    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.

  3. Dan J says:

    This error also seems to occur if you build and debug whilst the application is already running on the iPhone.

  4. Lee says:

    you saved me all sorts of time and frustration. thanks for putting the tip out there.

  5. Lee says:

    I’m afraid I spoke too soon. It did help, but only for one program run. There is something else going on here.

  6. Forrest says:

    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.

  7. Asad says:

    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.

  8. Lane Roathe says:

    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.

Leave a Reply

(required)

(required)

Powered by WP Hashcash

© 2010 Roathe.com Ideas From the Deep, llc Suffusion WordPress theme by Sayontan Sinha