If you find out why, please do report back. I'll do the same.
Thank you for the comment. I have the security fw added as it worked before with a previous rest kit. Also i have the cert added as trusted. So there must be something in the latest version.
Marton
Sent from my iPhone
Encountered an error: Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo=0x5d3fe30 {NSErrorFailingURLStringKey=https://someurl, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSErrorFailingURLKey=https://somurl, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSUnderlyingError=0x5d3b5d0 "An SSL error has occurred and a secure connection to the server cannot be made."}
#import <RestKit/RestKit.h>
@interface myRKHTTPRequestOperation : RKHTTPRequestOperation
@end
#import "myRKHTTPRequestOperation.h"
@implementation myRKHTTPRequestOperation
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
{
if([[protectionSpace authenticationMethod] isEqualToString:NSURLAuthenticationMethodServerTrust])
{
if([self bypassSslCertValidation:protectionSpace])
{
return YES; // Self-signed cert will be accepted
}
else
{
return [super connection:connection canAuthenticateAgainstProtectionSpace:protectionSpace]; // Self-signed cert will be rejected
}
}
return [super connection:connection canAuthenticateAgainstProtectionSpace:protectionSpace];
}
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
{
if([self bypassSslCertValidation:challenge.protectionSpace])
{
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
return; // Self-signed cert will be accepted
}
else
{
return [super connection:connection didReceiveAuthenticationChallenge:challenge]; // Self-signed cert will be rejected
}
return;
}
}
- (BOOL) bypassSslCertValidation:(NSURLProtectionSpace *) protectionSpace
{
if([[Environment getConfiguration] isEqualToString: @"DEV"] || [[Environment getConfiguration] isEqualToString: @"QA"])
{
DDLogInfo(@"Skipping SSL cert validation for Configuration %@", [Environment getConfiguration]);
return YES;
}
else
{
return NO;
}
}
@end
self.objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"www.mydomain.com"]];
[RKObjectManager setSharedManager:self.objectManager];
self.objectManager.requestSerializationMIMEType = RKMIMETypeJSON;
[self.objectManager registerRequestOperationClass:[myRKHTTPRequestOperation class]];