I now found a work-around to solve the problem**:
- Delete the cookie from the store (save the cookie for later)
- Issue the request using RestKit as normal
- Re-add the cookie to the cookie store in any completion blocks
** However, any clean solutions are very welcome and will happily be marked as answer
These are the methods I used:
- (void) disableSessionCookie{
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSArray *cookiesToDelete = @[@"myspecial_session"];
for (NSHTTPCookie *cookie in cookieStorage.cookies){
if([cookie.domain rangeOfString:@"myspecialdomain"].location != NSNotFound){
if([cookiesToDelete containsObject:cookie.name]){
self.sessionCookie = cookie;
[cookieStorage deleteCookie:cookie];
}
}
}
}
- (void) enableSessionCookie{
if(self.sessionCookie){
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:self.sessionCookie];
}
}