Solved

GET and POST requests from ios5

Posted on 2012-03-12
1
848 Views
Last Modified: 2012-03-12
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
0
Comment
Question by:HDM
1 Comment
 

Accepted Solution

by:
HDM earned 0 total points
Comment Utility
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
iPhone Voice Mail 1 44
Test iPhone 7 6 25
Upgrade iphone 6s plus from 9.3.2 to 9.3.3 5 72
Save Password on Citrix Mobile Receiver 1 38
In this article I'm going to cover the basics and usages of NSInvocation. What is NSInvocation? Apple Developer Reference describes NSInvocation this way: An NSInvocation is an Objective-C message rendered static, that is, it is an action tur…
Are you having trouble connecting or getting your iPhone / Samsung device(s) to sync with Microsoft Exchange Server?   What have you tried?   What haven't you tried?
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now