Last active
July 28, 2017 08:24
-
-
Save Daij-Djan/5187069 to your computer and use it in GitHub Desktop.
Response headers / statusCode from a UIWebView (using workaround till the webview gets extended!)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation DDViewController | |
- (void)viewDidAppear:(BOOL)animated { | |
NSURL *u = [NSURL URLWithString:@"http://www.google.de"]; | |
NSURLRequest *r = [NSURLRequest requestWithURL:u]; | |
[self.webView loadRequest:r]; | |
} | |
- (void)webViewDidFinishLoad:(UIWebView *)webView { | |
NSCachedURLResponse *resp = [[NSURLCache sharedURLCache] cachedResponseForRequest:webView.request]; | |
NSLog(@"%@",[(NSHTTPURLResponse*)resp.response allHeaderFields]); | |
} | |
@end |
any workaround for non-cacheable urls?
need a workaround too. Sometimes cachedResponseForRequest return nil
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
disclaimer only works for cacheable urls!