我試圖使用NSURLRequest
和NSURLConnection
從Web API獲取一小部分數據(大約50字節)。我很確定下面的代碼是正確的,但是我怎樣才能真正獲取收到的數據並檢測其全部下載的時間?如何檢測NSURLConnection何時完成
NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
NSURLConnection *con = [[NSURLConnection alloc] initWithRequest:req delegate:self];
Documentation page [here](http://developer.apple.com/library/mac/#documentation/Foundation/Reference/NSURLConnectionDelegate_Protocol/Reference/Reference.html) – bobobobo