DISQUS

~james/developer/blog: HTTP POST via the CFNetwork stack

  • jim · 1 year ago
    Thanks for the article, it really helped.
    p.s. Apple guidelines are really useless.
  • lars · 1 year ago
    Hello,

    first of all thank you for this great example code!
    But one thing leaves me puzzled: How to convert NSMutableData to NSString?
  • James "willia4" Williams · 1 year ago
    NSMutableData is a subclass of NSData so you can use it in every single place you can use an NSData. So just use NSString's -(id)initWithData:encoding: message exactly like I did at the very bottom of the example code. And pass in your NSMutableData as the first parameter to the message.

    You should also consider reading up on Objective-C basics before tackling CoreFoundation APIs. If you don't understand things like subclassing and Objective-C's dynamic type system, you'll be pretty lost.
  • Alex · 9 months ago
    Thanks for the guide!

    One nitpick: I've had trouble getting this code to work for submitting POST requests - the server wasn't seeing the parameters. Eventually, I found that using "application/x-www-form-urlencoded" for the Content-Type header field instead of "charset=utf-8" did the trick.
  • James "willia4" Williams · 9 months ago
    Thanks for the tip!
  • nareshbojja · 7 months ago
    Hi...

    I am trying to play a video on iPhone which is on IIS with integrated windows authentication. Can you post the code to do that..i am trying form last 2weeks, but no luck..

    thanks..
  • James "willia4" Williams · 7 months ago
    No. Of course not. For a variety of reasons.

    One: your question was asked in a somewhat incoherent fashion. I had to read it several times before I understood it. As you troll the Internet trying to find people to do your work for you, try something like this instead: "I have a video stored on an IIS server (which uses NTLM authentication) which I would like to play on an iPhone. As I am far too stupid and lazy to do the work myself, would you please give the code to me? I've been searching Google for the last two weeks, but so far, I have not found anyone willing to do my work for free!"

    Ordinarily, I would give someone a pass for not speaking English as a first language. However, based on other data, I believe that you actually CAN speak English, but are just too lazy to do it.

    Two: You're asking me to do work for you. This work is either for a job (so you're basically asking me to give you money) or for homework (so you're basically asking me to help you cheat). That's unethical. Your mother would be ashamed, assuming she's smart enough to know what any of those words means. Based on the child she raised, I suspect she's not.

    Three: This blog post is about OS X development. You're asking about iPhone development. These are very similar, but also very different. Your arrogance in assuming that I would gleefully spend time learning new skills just so I could work for you for free has reached new heights. I can't even think of a good insult for this. I guess it's a freebie.

    In conclusion, I kindly ask that you throw your computer into the nearest river. You are polluting my Internet with prideful ignorance and I want you to go away.