0

我对 HTTPS 感兴趣NSURLConnection。是否可以发送请求、响应质询并加载安全 URL?

还有什么可以NSURLConnection通过 HTTPS 完成的吗?

4

2 回答 2

4
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 实现适当的委托方法。

于 2009-06-01T18:12:04.487 回答
2

NSUrlConnection 开箱即用,支持 HTTPS。你不必做任何特别的事情。

于 2009-06-02T16:48:39.133 回答