Class

NSHTTPCookie

An NSHTTPCookie object represents an HTTP cookie. It is an immutable object, initialized from a dictionary containing the cookie attributes.

Overview

The NSHTTPCookie class supports two different cookie versions:

  • Version 0: This version refers to “traditional” or “old-style” cookies, the original cookie format defined by Netscape. The majority of cookies encountered are in this format.

  • Version 1: This version refers to cookies as defined in RFC 2965, HTTP State Management Mechanism.

Symbols

Create cookie instances

+ cookiesWithResponseHeaderFields:forURL:

Returns an array of NSHTTPCookie objects corresponding to the provided response header fields for the provided URL.

+ cookieWithProperties:

Creates and initializes an NSHTTPCookie object using the provided properties.

- initWithProperties:

Returns an initialized NSHTTPCookie object using the provided properties.

Convert cookies to request headers

+ requestHeaderFieldsWithCookies:

Returns a dictionary of header fields corresponding to a provided array of cookies.

Getting cookie properties

comment

The receiver's comment string.

commentURL

The receiver’s comment URL.

domain

The domain of the receiver’s cookie.

expiresDate

The receiver’s expiration date.

HTTPOnly

A boolean value that indicates whether the receiver should only be sent to HTTP servers per RFC 2965.

secure

A boolean value that indicates whether this cookie should only be sent over secure channels.

sessionOnly

A boolean value that indicates whether the receiver should be discarded at the end of the session (regardless of expiration date).

name

The receiver’s name.

path

The receiver’s path.

portList

The receiver's port list.

properties

The receiver’s cookie properties.

value

The receiver’s value.

version

The receiver’s version.

Constants

HTTP Cookie Attribute Keys

These constants define the supported keys in a cookie attributes dictionary.

Relationships

Inherits From