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 8815739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:27:08+00:00 2026-06-14T04:27:08+00:00

Im trying to make a post request to a server with basic authentification. I

  • 0

Im trying to make a post request to a server with basic authentification. I tried it with the AFNetwork Library and it works! Because I want to use Restkit and already used if for a lot of things I tried to do the same with it, but it doesnt work. My code looks like that:

    RKClient *client = [[RKClient alloc] initWithBaseURL:URL];
    client.username = @"username";
    client.password = @"password";
    client.authenticationType = RKRequestAuthenticationTypeHTTPBasic;
    client.disableCertificateValidation = YES;


    RKRequest *request = [client post:@"mypath" params:nil delegate:self];
    [request sendSynchronously];

But in the delegate

- (void)request:(RKRequest *)request didFailLoadWithError:(NSError *)error {

I always get the error:

NSLocalizedDescription=The certificate for this server is invalid. You
might be connecting to a server that is pretending to be #######
HIDDEN ####### which could put your confidential information at risk.,
_kCFNetworkCFStreamSSLErrorOriginalValue=-9813, _kCFStreamPropertySSLClientCertificateState=0, NSLocalizedRecoverySuggestion=Would you like to connect to the server
anyway?

But I set the

disableCertificationValidation

to YES

I also tried to follow the information here RestKit Pull. But that was also not helpful at all. Has anybody an idea, what can be wrong? With the AFNetwork Library the code is more or less the same, but works.

  • 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-14T04:27:10+00:00Added an answer on June 14, 2026 at 4:27 am

    At least, I did not get my solution over RestKit. I tried everything, also added the certificates with addRootCertificates, but RestKit always get the same error.
    In the end, I did it on my own.

    NSData* certData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"MyCert" ofType:@"cer"]];
    
    [FileUtility addCertToKeychain:certData];
    

    Method addCertToKeychain:

    #pragma mark SSL Certification Methods
    + (void) addCertToKeychain:(NSData*)certInDer
    {
        OSStatus            err = noErr;
        SecCertificateRef   cert;
    
        cert = SecCertificateCreateWithData(NULL, (__bridge CFDataRef) certInDer);
        assert(cert != NULL);
    
        CFTypeRef result;
    
        NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
                              (__bridge id)kSecClassCertificate, kSecClass,
                              cert, kSecValueRef,
                              nil];
    
        err = SecItemAdd((__bridge CFDictionaryRef)dict, &result);
        assert(err == noErr || err == errSecDuplicateItem);
    
        CFRelease(cert);
    }
    

    Probably it helps someone.

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

Sidebar

Related Questions

I`m trying to make my Go server send POST request with an array of
I'm trying to use Zend_Http_Client to make a simple post request on a site
I am trying to make a POST http.request in Node to an API where
I'm trying to make a post request with jQuery in a web application with
I am trying to make an Http POST to an Apache web server. I
I am trying to make a POST request. Here my code: var myModel =
I'm trying to make a POST request to my Sinatra app, but I'm having
I am trying to make a Http POST request using apache HTTP client. I
I'm trying to make a Cross Origin post request, and I got it working
I'm trying to set up a simple test to make a POST request to

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.