Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9126477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:03:12+00:00 2026-06-17T07:03:12+00:00

I’ve been trying to look for online articles / tutorials on how to go

  • 0

I’ve been trying to look for online articles / tutorials on how to go about coding a request from a wcf service. I have the following web service uploaded to my server:

[ServiceContract]
    public interface IUserAccountService
    {
        [OperationContract]
        [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, UriTemplate = "UserLogIn?id={email}&password={password}")]
        AuthenticationToken UserLogIn(string email, string password);
    }

I’m getting really confused with the articles or SO questions that are related to it that I’ve been finding:

eg:

  • -http://stackoverflow.com/questions/1557040/objective-c-best-way-to-access-rest-api-on-your-iphone

  • -http://stackoverflow.com/questions/8650296/nsjsonserialization-parsing-response-data

and finally stumbled upon this:

http://iam.fahrni.ws/2011/10/16/objective-c-rest-and-json/

So my question is, do I really need to use a restful frameworks to do a call to an api? If so which one is more recommended – ASIHttpRequest or RestKit or AFNetworking? Or can I just simple do it myself using the last link I mentioned? I really am not sure where to start.

Thanks for your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:03:13+00:00Added an answer on June 17, 2026 at 7:03 am

    NSURLConnection and NSJSONSerialization work fine.

    edit: Some example code from one of my projects, edited for brevity.
    fstr(…) is just a wrapper around [NSString stringWithFormat:…]
    I call this code on a background thread with GCD. It’s not thread safe.

    - (NSMutableURLRequest *)buildGetRequestHeaderWithMethod:(NSString *)method
    {
      NSMutableURLRequest *request = [[NSMutableURLRequest alloc]
        initWithURL:[NSURL URLWithString:fstr(@"%@%@", self.url, method)]];
      [request setTimeoutInterval:10.0];
      [request setHTTPMethod:@"GET"];
      [request setValue:self.key forHTTPHeaderField:@"Authentication"];
      [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
      return request;
    }
    
    - (id)callMethod:(NSString *)method
    {
      NSMutableURLRequest *request = [self buildGetRequestHeaderWithMethod:method];
      return [self sendRequest:request withMethod:method];
    }
    
    - (id)sendRequest:(NSMutableURLRequest *)request withMethod:(NSString *)method
    {
      NSHTTPURLResponse *response = nil;
      NSError *error = nil;
      [state() pushNetworkActivity];
      NSData *result = [NSURLConnection sendSynchronousRequest:request
        returningResponse:&response error:&error];
      [state() popNetworkActivity];
      self.lastStatusCode = response.statusCode;
      // Bug in Cocoa. 401 status results in 0 status and NSError code -1012.
      if(error && [error code] == NSURLErrorUserCancelledAuthentication)
      {
        [self interpretHTTPError:401 URLError:error forMethod:method];
        self.lastStatusCode = 401;
        return nil;
      }
      if(response.statusCode != 200)
      {
        [self interpretHTTPError:response.statusCode URLError:error forMethod:method];
        return nil;
      }
      id jsonResult = [self parseJsonResult:result];
      debug(@"%@", jsonResult);
      return jsonResult;
    }
    
    
    - (void)interpretHTTPError:(int)statusCode URLError:(NSError *)urlError
      forMethod:(NSString *)method
    {
      NSString *message = fstr(@"HTTP status: %d", statusCode);
      if(statusCode == 0)
        message = [urlError localizedDescription];
    
    #ifdef DEBUG
        message = fstr(@"%@ (%@)", message, method);
    #endif
    
      if(self.alertUserOfErrors)
      {
        dispatch_async(dispatch_get_main_queue(), ^{
          errorMessage (message);
        });
      }
      else
        debug(@"%@", message);
      self.lastErrorMessage = message;
    }
    
    - (id)parseJsonResult:(NSData *)result
    {
      if( ! result)
        return nil;
      NSError *error = nil;
      id jsonResponse = [NSJSONSerialization JSONObjectWithData:result
        options:NSJSONReadingMutableContainers error:&error];
      if(error)
      {
        NSLog(@"JSONObjectWithData failed with error: %@\n", error);
        return nil;
      }
      return jsonResponse;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view passing on information from a database: def serve_article(request, id): served_article
I have a jquery bug and I've been looking for hours now, I can't
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I have a text area in my form which accepts all possible characters from
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have been unable to fix a problem with Java Unicode and encoding. The
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.