0
好的,這裏沒什麼特別的,沒有錯誤,我確實聲明NSMutableData *receivedData;
但我返回<>當我期望返回一個網頁時;這是怎麼回事?簡單的NSURL出來蘋果文檔不工作?
- (void)viewDidLoad {
[super viewDidLoad];
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.apple.com"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) {
receivedData = [[NSMutableData data] retain];
NSLog(@"receivedData %@", receivedData);
} else {
// inform the user that the download could not be made
}
}
是的,天哪我覺得啞巴。添加代表,最後我會吐出一堆字節,假設只需要將它們轉換爲可讀的文本。 – 2009-11-24 19:22:35