In a previous answer I found on stackoverflow (can't find now) someone suggested using NSRange rangeOfString to see if a particular variable had data in it from a cookie:
NSRange range = [[[NSHTTPCookie requestHeaderFieldsWithCookies:[[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:cookie]]] objectForKey:@"Cookie"] rangeOfString:@"variable"];
if (range.length != NSNotFound) {
//it has data
} else {
//it doesn't
}
From what resources I can find this should work, but it doesn't, even when the cookie is null.
What am I doing wrong?