Link to home
Start Free TrialLog in
Avatar of Curtis Long
Curtis LongFlag for United States of America

asked on

GET and POST requests from ios5

I'm working on making a client for my REST service on the iPhone. I'm a little lost as to how I go about making the GET and POST requests. I make the url from a NSString, convert it to an NSURL and create the NSURLRequest based off of the url. After that I'm pretty lost. Also, sometimes I care about the response, other times I don't. For example, when making a request for a new id, I care about the response because it's the id I'll use to upload my file later, but when I upload the file I don't care because the server doesn't send a response.

Does anyone have some (hopefully)simple sample code that they could point me to / share?

What I have so far
-(NSString *) makeGetRequest:(NSString *)url :(Boolean)careAboutResult
{
    NSString *results = nil;
    
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
    NSError *reqError;
    NSURLResponse *response = nil;
    if(careAboutResult == YES)
    {
        //get the result
    }
    return results;
}

Open in new window


In the code I'm testing with, the URL is http://192.168.0.108:8081/TestUploadService/RestfulUpload.svc/id/test123_DOT_png and I'm saying I do care about the result.

Any help would be great
ASKER CERTIFIED SOLUTION
Avatar of Curtis Long
Curtis Long
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial