如何在NSURLConnection中使用HTTPS? [英] How to use HTTPS with NSURLConnection?
本文介绍了如何在NSURLConnection中使用HTTPS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对使用 NSURLConnection
的HTTPS感兴趣。是否可以发送请求,回复质询并加载安全URL?
I'm interested in HTTPS with NSURLConnection
. Is it possible to send a request, respond to a challenge and load the secure URL?
还有什么可以用 NSURLConnection
通过HTTPS?
Is there anything else that can be done with NSURLConnection
via HTTPS?
推荐答案
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];
然后为NSURLConnection实现适当的委托方法。
and then implement the appropiate delegate methods for NSURLConnection.
这篇关于如何在NSURLConnection中使用HTTPS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文