Skip to content

Instantly share code, notes, and snippets.

View danieloskarsson's full-sized avatar

Daniel Oskarsson danieloskarsson

View GitHub Profile
- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSHTTPURLResponse *)response {
if (request != nil) {
NSLog(@"request was %@", request);
}
if (response != nil) {
NSLog(@"response was %@", response);
}
return request;
+ (void)clearCaches {
// clear any URL caches
[[NSURLCache sharedURLCache] removeAllCachedResponses];
// clear any cookie caches
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://%@/", kAPIHost]];
for (NSHTTPCookie *cookie in [cookieStorage cookiesForURL:url]) {
[cookieStorage deleteCookie:cookie];
}