iPhone: NSHTTPCookie is not saved across app restarts
You can save the cookie by saving its properties dictionary and then restoring as a new cookiebefore you go to re-connect. Save: NSArray* allCookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:URL]]; for (NSHTTPCookie *cookie in allCookies) { if ([cookie.name isEqualToString:MY_COOKIE]) { NSMutableDictionary* cookieDictionary = [NSMutableDictionary dictionaryWithDictionary:[[NSUserDefaults standardUserDefaults] dictionaryForKey:PREF_KEY]]; [cookieDictionary setValue:cookie.properties forKey:URL]; [[NSUserDefaults standardUserDefaults] setObject:cookieDictionary forKey:PREF_KEY]; } } … Read more