2013-04-23 11 views
0
HTTPS連接

我寫了一個短的iOS應用,通過接觸常用的服務器:重用在iOS

NSString *URLString = @"http://mysite/script.php?foo=1"; 
NSURL *getURL = [NSURL URLWithString:URLString]; 
NSURLRequest *getRequest = [NSURLRequest requestWithURL:getURL]; 
NSURLResponse *response = nil; 
NSError *error = nil; 
NSData *responseData = [NSURLConnection sendSynchronousRequest:getRequest returningResponse:&response error:&error]; 

這工作不錯,但我訪問的網站相對頻繁與foo各種值,並且隨着我們計劃遷移到https,人們提出了關於每次設置和拆除NSURLConnection的電話開銷的問題。我看到this answer saying that the class handles caching,但對於https也是如此?

+0

我確定像使用afhttpclient – HalR 2013-04-23 05:12:00

回答

0

根據我的測試,是的,它看起來確實是NSURLConnection類在某種程度上緩存https。我的確喜歡評論中提到的AFHTTPClient的外觀,但由於各種問題,我無法在此項目中使用它。