2010-07-13 52 views

回答

1

不,你需要從URL Loading System Guide

// Create the request. 
NSURLRequest *theRequest=[NSURLRequest 
         requestWithURL:[NSURL URLWithString:@"http://www.apple.com/"] 
         cachePolicy:NSURLRequestUseProtocolCachePolicy 
        timeoutInterval:60.0]; 
// create the connection with the request 
// and start loading the data 
NSURLConnection *theConnection=[[NSURLConnection alloc] 
           initWithRequest:theRequest delegate:self]; 

(注意delegate:self部分)指定的代表,如本例。

+1

一個警告:NSURLConnection保留其代表。這在過去造成了一些相當大的麻煩...... – robinjam 2010-07-13 14:38:55

+0

謝謝,我會記下這一點! – TheLearner 2010-07-13 14:49:15

相關問題