NSMutableDictionary *cookieProperties = [NSMutableDictionary dictionary];
[cookieProperties setObject:@"testCookie"forKey:NSHTTPCookieName];
[cookieProperties setObject:@"someValue123456"forKey:NSHTTPCookieValue];
[cookieProperties setObject:@"www.example.com"forKey:NSHTTPCookieDomain];
[cookieProperties setObject:@"www.example.com"forKey:NSHTTPCookieOriginURL];
[cookieProperties setObject:@"/"forKey:NSHTTPCookiePath];
[cookieProperties setObject:@"0"forKey:NSHTTPCookieVersion];
// set expiration to one month from now or any NSDate of your choosing
// this makes the cookie sessionless and it will persist across web sessions and app launches
/// if you want the cookie to be destroyed when your app exits, don't set this
[cookieProperties setObject:[[NSDate date] dateByAddingTimeInterval:2629743] forKey:NSHTTPCookieExpires];
NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:cookieProperties];
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];