Request Data from Web Server

Discussion in 'iOS Programming' started by CNuland, Jun 17, 2010.

  1. CNuland macrumors newbie

    Joined:
    Jun 17, 2010
    #1
    I'm a software engineer that is rather new to programming on the IPhone platform. I'm developing an app for my office that allows communication with our web server. I've been able to find a way to download information to the server by using a NSMutableURLRequest and then using an HTTP POST to send information to a php script. However, I have not been able to come up with a solution on how to upload information from the server to the IPhone.

    I tried looking into the stringByEvaluatingJavaScriptFromString command, but also ran into a dead end with that. Any help would be nice, even if it's pointing me in another direction. Thanks for the help.

    Sincerely,
    Chris Nuland
     
  2. ahartford macrumors newbie

    Joined:
    Jun 1, 2010
    Location:
    Greater Boston
    #2
    Have you considered using push notifications?
     
  3. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #3
    NSURLConnection to connect to a URL on the server that will send the data as an response. Simply turn the NSData (once you have it) into a NSString using the appropriate encoding.
     
  4. CNuland thread starter macrumors newbie

    Joined:
    Jun 17, 2010
    #4
    Thanks guys, I'm impressed with the speedy reply :). I'll research what you both mention and see what I can find.

    Thanks again for your help.

    -Chris Nuland
     
  5. ahartford macrumors newbie

    Joined:
    Jun 1, 2010
    Location:
    Greater Boston
    #5
    If you go the NSURLConnection route (depends on how you need the data delivered and who drives the process; phone or server), I would suggest looking at Apple's SeismicXML sample project. It shows how to asynchronously download and process response data (XML in this case) from a server.

    The XML aspects of this project might be helpful as well because it sounds like you may want to deploy a RESTful web service for your app to communicate with. Then, maybe read this: http://www.cimgf.com/2010/02/12/accessing-the-cloud-from-cocoa-touch/
     

Share This Page