Cómo utilizar HTTPS con NSURLConnection?
-
06-09-2019 - |
Pregunta
Me interesa HTTPS con NSURLConnection
. ¿Es posible enviar una solicitud, responder a un reto y cargar la URL seguro?
¿Hay algo más que se puede hacer con NSURLConnection
a través de HTTPS?
Solución
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://monsite/mapage.php"]
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:60.0];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[[NSString stringWithFormat:@"score=222"] dataUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
and then implement the appropiate delegate methods for NSURLConnection.
Otros consejos
NSUrlConnection works out of the box with HTTPS. You do not have to do anything special.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow