Estoy tratando de establecer una conexión HTTPS a un servidor utilizando mi aplicación. Pero la conexión falla debido al siguiente errorError de SSL en la conexión al servidor a través del iPhone
Error Domain = NSURLErrorDomain Code = -1200 "Se ha producido un error SSL y no se puede establecer una conexión segura con el servidor." UserInfo = 0x612eb30 {NSErrorFailingURLStringKey = https: myURL.com/signup, NSLocalizedRecoverySuggestion = ¿Desea conectarse al servidor de todos modos ?, NSErrorFailingURLKey = https: myURL.com/signup, NSLocalizedDescription = Se ha producido un error de SSL y una conexión segura al servidor servidor no puede hacerse., NSUnderlyingError = 0x612eb70 "se ha producido un error SSL y una conexión segura con el servidor no puede ser hecho."}
el código para conectarse al servidor es
-(IBAction) handleEvents:(id)sender
{
if ((UIButton*)sender == submit) {
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
NSLog(@"Begin");
NSData *urlData;
NSURLResponse *response;
NSError *error;
NSString *url =[[NSString alloc]initWithFormat:@"%@signup",baseURL];
NSURL *theURL =[NSURL URLWithString:url];
NSMutableURLRequest *theRequest =[NSMutableURLRequest requestWithURL:theURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:0.0f];
[theRequest setHTTPMethod:@"POST"];
NSString *theBodyString = [NSString stringWithFormat:@"emailId=%@&mobileNumber=%@&appId=%@&password=%@&firstName=%@&lastName=%@"
,@"[email protected]",@"919879876780",@"bf1c7a6b3d266a7fe350fcfc4dda275211c13c23" ,@"qwerty" , @"Dev" , @"Sri"];
NSData *theBodyData = [theBodyString dataUsingEncoding:NSUTF8StringEncoding];
[theRequest setHTTPBody:theBodyData];
urlData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&error];
}
}
mi delegado los métodos son
- (void)handleError:(NSError *)error
{
NSLog(@"----->%@",error);
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
}
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge (NSURLAuthenticationChallenge *)challenge {
NSLog(@"check auth");
[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}
Estoy atrapado aquí y no pude encontrar ninguna salida.
Cualquier forma de ayuda sería muy apreciada.
gracias de antemano!
¿Cómo resolver esto para el desarrollo local? –
No es un problema de CA, solo porque la versión de SSL es demasiado baja. –