私は一度同じ問題に遭遇し、ASIWebPageRequestを使用して解決しました。当時は古いものでしたが、まだ動作します。
フォルダーに Web ページをダウンロードするためのメソッド (サンプル メソッドに基づく) を作成しました。これを機能させるには、これを変更する必要があります。
- (IBAction)loadURL:(NSURL *)url inFolder:(NSString*)folderPath
{
// Assume request is a property of our controller
// First, we'll cancel any in-progress page load
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
[[self request] setDelegate:nil];
[[self request] cancel];
[self setRequest:[ASIWebPageRequest requestWithURL:url]];
[[self request] setDelegate:self];
[[self request] setDidFailSelector:@selector(webPageFetchFailed:)];
[[self request] setDidFinishSelector:@selector(webPageFetchSucceeded:)];
// Tell the request to embed external resources directly in the page
[[self request] setUrlReplacementMode:ASIReplaceExternalResourcesWithData];
self.theCache.storagePath = folderPath;
// It is strongly recommended you use a download cache with ASIWebPageRequest
// When using a cache, external resources are automatically stored in the cache
// and can be pulled from the cache on subsequent page loads
self.request.cacheStoragePolicy = ASICachePermanentlyCacheStoragePolicy;
[[self request] setDownloadCache:self.theCache];
// Ask the download cache for a place to store the cached data
// This is the most efficient way for an ASIWebPageRequest to store a web page
//[[self request] setDownloadDestinationPath:
//[[ASIDownloadCache sharedCache] pathToStoreCachedResponseDataForRequest:[self request]]];
[[self request] setDownloadDestinationPath:[self.theCache pathToStoreCachedResponseDataForRequest:[self request]]];
[[self request] startAsynchronous];
}
ASIDownloadCache も使用しました。
...
ASIDownloadCache *localCache = [[ASIDownloadCache alloc] init];
self.theCache = localCache;
...