Update: Another option is to use NSURLProtocol
to hear requests the application makes, including all the ones from the web view.
I will suggest a creative solution. This is not really what you want, but since that is not really possible at this point with the SDK, this is the only possible solution.
@interface PrintingCache : NSURLCache
{
}
@end
@implementation PrintingCache
- (NSCachedURLResponse*)cachedResponseForRequest:(NSURLRequest*)request
{
NSLog(@"url %@", request.URL.absoluteString);
return [super cachedResponseForRequest:request];
}
@end
Now in your app delegate, do the following:
NSString *path = ...// the path to the cache file
NSUInteger discCapacity = 10*1024*1024;
NSUInteger memoryCapacity = 512*1024;
FilteredWebCache *cache = [[Printing alloc] initWithMemoryCapacity: memoryCapacity diskCapacity: discCapacity diskPath:path];
[NSURLCache setSharedURLCache:cache];
This creates a shared cache, and all of your application's URL requests will go through this cache, including your web view. However, you may get more URLs from other sources that you do not want.