NSURLConnectionでHTTPSを使用する方法?
-
06-09-2019 - |
質問
私はNSURLConnection
とHTTPSに興味があります。それは、リクエストを送信チャレンジに応答して、安全なURLをロードすることはできますか?
HTTPS経由NSURLConnection
で行うことができる何か他のものがありますか?
解決
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.
他のヒント
NSUrlConnection works out of the box with HTTPS. You do not have to do anything special.
所属していません StackOverflow