On Feb 6, 2012, at 4:43 AM, Quinn The Eskimo! wrote: IMPORTANT: These methods are considered private API and thus a) engender a binary compatibility liability, and b) are disallowed for App Store apps.
a) If this bug is fixed in the future (god forbid) then my methods just won’t be called anymore, so this doesn’t seem like a problem. Conversely, if someone at Apple just changes those messages without actually fixing the underlying bug that sends them to innocent 3rd party classes, then I will send them a package of poop* in the mail.
b) Really? I know the App Store checker will make sure I’m not _calling_ private methods, but does it really keep me from creating a method with an “_” at the start of its name?
A better solution is to use a bound pair of streams, as returned by CFStreamCreateBoundPair. The POST functionality in the SimpleURLConnections sample code shows the way.
Um, a couple of quick notes before I dive into this:
[1] This tip would have been even better if you’d pointed it out in your message on Friday, before I spent half the weekend struggling with this problem. :/ [2] I’ve never heard of CFStreamCreateBoundPair before, and the doc say basically nothing; I’m guessing it connects the streams such that writing to the output stream causes bytes to become available on the input stream? So in this case I would set the input stream as the HTTPBodyStream, then set my code as the delegate of the output stream and write stuff to it as space becomes available? [3] “SimpleURLConnections” should be renamed “URLConnectionsShowingOffSubtleStreamTricksFewMortalsKnowAbout”. Then I might not have ignored it when it showed up in a search :-/
But all snarkiness aside, the bound pair does look like a great solution to this problem. Thanks!
—Jens
* Just kidding, friendly DHS eavesdroppers! I understand that mailing poop is unsanitary and unAmerican.
|