I’ve been playing with the ‘MiniBrowser’ which is in the Developer examples, but have one problem which I can’t resolve. I’m trying to download a zipped file from a website but nothing happens.
I’ve tried the following code but still nothing happens
// Starts download
- (void)download
{
NSURL *myURL = [NSURL URLWithString:@“http://www.apple.com/”];
[myURL loadResourceDataNotifyingClient:self usingCache:YES];
}
// This method will be called when the download has finished
-
(void)URLResourceDidFinishLoading:(NSURL *)sender
{
NSData *urlContents = [sender resourceDataUsingCache:YES];if ([urlContents writeToFile:[@“~/Documents/applewebsite.html”
stringByExpandingTildeInPath]
atomically:YES])
{
// It was successful, do stuff here
} else {
// There was a problem writing the file
}
}
Any help would be great…
PaulB