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

  • Home
  • SEARCH
  • 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 3959376
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:43:23+00:00 2026-05-20T02:43:23+00:00

I am currently building an iOS app that uses Kosmaczewski’s Objective-C REST client/wrapper to

  • 0

I am currently building an iOS app that uses Kosmaczewski’s Objective-C REST client/wrapper to connect to a public API.

This public API uses basic authentication over HTTPS.

The problem I’ve had is that when I try to provide a username/password using the wrapper’s interface, it crashes. After doing some searching, I believe this is related to a bug discussed in these two threads:

  • https://devforums.apple.com/message/109867#109867
  • http://forums.macrumors.com/showthread.php?t=786398

Currently, for the sake of moving along development, I’m providing the username/password in the URL in the format: https://admin:pass@site.com

I really need to find a solution to this to do this properly though. I don’t like the idea of hacking around it by generating a base64 encoded string and modifying the authentication header. Nor do I want to depart from this wrapper (which is very easy to implement) to using something like ASIHTTPRequest.

So my question would be: Is this really a bug? Is there another explanation for what’s happening? What techniques would you suggest to try to get around it?

If you want to look at any code, please see the wrapper as I’m simply implementing it. https://github.com/akosma/iphonerestwrapper

Thanks much!

  • 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-05-20T02:43:23+00:00Added an answer on May 20, 2026 at 2:43 am

    While you don’t want to depart from the wrapper class, it sounds like this is a bug in the wrapper class. NSUrlConnection doesn’t have this issue if used by itself, and it’s also extremely easy to implement. Here’s some sample code for working with REST services that use HTTP authentication, if you choose to go that route. Very simple

    
    -(void)makeConnection{
    
        NSURL *statusURL = [[NSURL alloc] initWithString:@"URLHERE"];
        NSURLRequest *request = [[NSURLRequest alloc] initWithURL:statusURL];
        //change this to GET/PUT/POST/whatever you need
        [request setHTTPMethod:@"PUT"];
    
        NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
    
        [statusURL release];
        [request release];
    
        [conn start];
    
        [conn release];
    
        responseData = [[NSMutableData alloc] init];
    }
    
    -(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
    {
        if ([challenge previousFailureCount] == 0) 
        {
            NSLog(@"Sending credentials");
    
            NSURLCredential *newCredential;
            newCredential = [NSURLCredential credentialWithUser:@"USERNAME" password:@"PASSWORD" persistence:NSURLCredentialPersistencePermanent];
            [[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge];
        }
        else
        {
            [[challenge sender] cancelAuthenticationChallenge:challenge];
    
            // inform the user that the user name and password
            // in the preferences are incorrect
            NSLog(@"credentials are no good :(");
        }   
    }
    
    

    I’d avoid using a wrapper, since the URL Loading system is very powerful on it’s own, introducing more complexity always introduces more bugs 🙂

    For more info : http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building an iOS app that uses push notifications, and I'm finally ready to
I'm currently building a web-based file upload/download hub for a company that wanted an
Currently, I'm building my first app for the app store therefore I have read
i'm currently developing an app for both Android and iOS, thing is... I started
I'm about to start building an iPad client for an existing WCF service that
I am currently building a web application for my work and you can add
I'm currently building a set of common functions (Search algorithm implementations), and think I'm
I'm currently building a couple of ASP.NET MVC 2 sites, and am wondering what
I'm currently building a Java Swing GUI and I was wondering how user (mouse,
I'm currently building a site where I want anonymous users to see a page

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.